Saturday, May 30, 2009

Dirty way to solve "Cross thread operation not valid" error

// Dirty way to solve "Cross thread operation not valid" error

System.Windows.Forms.Control.CheckForIllegalCrossThreadCalls = false;

// [put thread dirty code here - like setting property of a Form created
// in another form, which is a deadly sin by Microsoft]

System.Windows.Forms.Control.CheckForIllegalCrossThreadCalls = true;

No comments:

Post a Comment