September 23, 2007

Fixing "Cross-thread operation not valid"


Did you ever get this error? Well I did! I got it pretty often lately…

But I found a quick fix that you can use to fix that issue instead of writing a lot of thread handling code, joining the threads, and so on…

You can just use this little snippet in your application’s Main void

Here it goes:
CheckForIllegalCrossThreadCalls = false;

P.S. Remember to add System.Windows.Forms to your assembly!


Back to Home