am i missing something here. i get error
'Txt' is a 'variable' but is used like a 'method'       E:\TradingTools\CODE
\collectTickData\Form1.cs

i dont see anything wrong.

        private delegate void appendToTextBoxDelegate(String Txt);

        private void appendToTextBox(String Txt)
        {
            if (this.InvokeRequired)
            {
                this.BeginInvoke(new appendToTextBoxDelegate(Txt), new
object[] { Txt }); // <<<<<<<<<THIS IS WHERE IT ERRORS OUT.
                return;
            }
            textBox1.Text += Txt;
        }


On Oct 31, 3:16 pm, Glenn <[EMAIL PROTECTED]> wrote:
> Here's a sample of InvokeRequired/BeginInvoke.  I had to dig around my code
> to find one that I use.  Modify it as needed to suit your needs.
>
>       private delegate void UpdateTxtDelegate(String Txt);
>       private void UpdateTxt(String Txt)
>       {
>          if (this.InvokeRequired)
>          {
>             this.BeginInvoke(new UpdateTxtDelegate(UpdateTxt),
>                                     new object[] { Txt });
>             return;
>          }
>          txtBox.Text += Txt;
>       }
>
> ...Glenn
>
>
>
> On Fri, Oct 31, 2008 at 3:03 PM, Glenn <[EMAIL PROTECTED]> wrote:
> > You are getting that error because you are attempting to update a control
> > from another thread.
>
> > The best way to handle this is with delegates.  You utilize the
> > InvokeRequired/BeginInvoke methods to transfer the update request from the
> > background thread to the UI updater thread.
>
> > ...Glenn
> > On Fri, Oct 31, 2008 at 2:19 PM, Dickery1 <[EMAIL PROTECTED]> wrote:
>
> > i get a error cross thread operation not valid when it is trying to
> > write to the textfield.- Hide quoted text -
>
> - Show quoted text -

Reply via email to