I want to create a program that does remote installs. I’d like to be able to have a window launch at the start of each installation and give a progress bar with the approximate progress of the job.
If I create the window off the main thread I can access all of it’s elements but it’s not responsive due to the task of actually running the install. If I launch the window in a new thread I can’t seem to get the main thread to recognize any of the elements in the window so I can’t update the progress bar.
How can I create a multi-threaded UI that is responsive?
To keep the UI responsive with a second thread (that’s doing the work) and be able to update the UI from the second thread, you’ll need to use Invoke on the controls. There’s a number of code snippets available out there.
Here’s a short example: How can I update my user interface from a thread that did not create it?
You can find dozens of examples here on SO as well – just do a search 🙂
Here’s another similar question on SO today – cross threading problem – there’s a code example in one of the answers.