I'm write simple application to load csv file,and in c# code start the new thread to load heavy csv file with this code:
Thread workerThread = new Thread(DoWork);
workerThread.Priority = ThreadPriority.Highest;
workerThread.Start();
and into the DoWork i try run this code:
public void DoWork()
{
label1.Text = "ok";
}
but when receive label line i get this error:
An unhandled exception of type 'System.InvalidOperationException' occurred in System.Windows.Forms.dll
Additional information: Cross-thread operation not valid: Control 'label1' accessed from a thread other than the thread it was created on.
What happen?thanks.