Contents tagged with InvokeIfRequired
today I want to document simple but very useful feature if you work with multiple threads in Winforms application.
Quite often it happens that you execute in some paralel thread long running calculations and would like time from the time notify results to UI.
But if you try to do this then you'll get an error that will say to you that parallel thread doesn't have permissions to some control because it didn't create such a control. So, how then update UI?
The answer is simple, you should use method Invoke of the control. In that case everything inside of method Invoke will be executed from UI thread.
Needless to say that such approach is workable but to some degree … more