how do you update a win forms control (ex. label, progress bar) from another class which created the GUI but not in the creating thread? (for example, an event handler of Program.cs)
I've found several posts regarding updating GUI from another thread using Invoke() method, but what i've found so far only works if the codes are written in the same class as the form
Best Answer
You need to call the
Invoke
method on the form. For example:If you don't need the updates to be finished before returning back to the method, you should use
BeginInvoke
instead ofInvoke
.