Forum guidelines
  • Home
  • »
  • C# Language
  • »
  • Cross-thread operation not valid: Control 'richTextBox1' accessed from a thread other than the thread it was created on.
AuthorQuestion
Cross-thread operation not valid: Control 'richTextBox1' accessed from a thread other than the thread it was created on.
Posted on: 05 Oct 2008
How to do you handle a unsafe crossthread call to add text to the richtextbox in a asynccallback that is on a different thread than the thread that created the richtextbox?
AuthorReply
Alan
  • 3
  • 0
Re: Cross-thread operation not valid: Control 'richTextBox1' accessed from a thread other than the thread it was created on.
Posted on: 05 Oct 2008  

Try doing it something like this (.NET 2.0 or later):

this.BeginInvoke(new MethodInvoker(delegate()
{
   this.richTextBox1.Text  += "whatever";
}));


SPONSORED BY

Custom Software Development
MCN is your source for developing solutions involving websites, mobile apps, cloud-computing, databases, BI, back-end services and processes and client-server applications.