none
BackgroundWorker-Cross-Thread operation not valid: Control accessed from a thread other than the thread it was created on...? RRS feed

  • Question

  • I've the following code which caused exception in BackgroundWorker_DoWork() (Threading),

    Exception:

    Cross-Thread operation not valid: Control 'TextBox1' accessed from a thread other than the thread it was created on

     

    Class FormA

    {

       private FormB formBObj;

     

    private void FormA_load()

    {

       formBObj = new FormB();

       ...

    }

     

    private void BackgroundWorker_DoWork()

    {

       formBObj.TextBox1.text = "This is a test";

    }

    }

     

    How to make it work?

     

    Thanks.

    Wednesday, February 13, 2008 2:38 AM

Answers