Background Worker Issue

closed account (Gy7oizwU)
Hi All

I am new to working with backgroundworkers. (using visual studio 2008)

I have a form which has a combo box on it. I have a button which, when clicked, will iterate through the values in the combo box and restart each of the services on the machine. This is obviously time consuming and the app is unresponsive so i want to use a second thread. However, when i run the function in a second thread, i get an exception. Do i need to now pass the combobox as a parameter to the function as its a new thread?

Thanks
juanimp wrote:
Do i need to now pass the combobox as a parameter to the function as its a new thread?
Nope, better collect the strings into an array and pass that array to the thread. So your gui is completely decoupled from the thread.
closed account (Gy7oizwU)
Great, thanks. Got it working.
Topic archived. No new replies allowed.