25 Aralık 2009 Cuma

"Cross-thread operation not valid" exception in VS 2008.

Exception: Cross-thread operation not valid. "Control 'textBox1' accessed from a thread other than the thread it was created on. "

When more than one thread try to access a control, we get this exception in multithread applications.

Solution: Paste the following line into your Page_Load method.So your program will not catch this kind of situations any more.
             Control.CheckForIllegalCrossThreadCalls = false;

Have a nice day!

2 yorum: