Yes..you cannot update controls on non-UI thread so if you want other threads
to do something with your controls you must marshal it to UI thread...
How??
Well, each control has methods Invoke( ) and BeginInvoke( ). They accept
a delegate ( a pointer to some function) and arguments to be called on
UI-thread.
delegate void UpdateUIDelegate(int value);
private void DoLongCalculation( ) {
int progress = 0;
while( true) {
m_progressBar.Invoke( new UpdateUIDelegate(UpdateUI), progress);
}
}
private void UpdateUI(int value) {
m_progressBar.Value = value;
}