BackgroundWorker and cross threading

Bonekrusher

Active member
Joined
Jul 4, 2007
Messages
38
Programming Experience
1-3
Hi,

I am running a Backgroundworker which needs a value from a ComboBox. How do I access the combobox value without getting"

Cross-thread operation not valid: Control 'combobox1' accessed from a thread other than the thread it was created on.

Thanks
 
If you need to get data from the UI for your background operation then you should pass it to the RunWorkerAsync method as a parameter when you start the BackgroundWorker. You then get the data back from the e.Argument property within the DoWork event handler.
 
Back
Top