I have a form with a ComboBox
named cableGaugeSelect
. At times I need to read the currently selected index in response to a serial message. The code doesn't have a problem reading text boxes or check boxes, but when it gets to reading the selected index
cableGaugue[0] = (byte) cableGaugeSelect.SelectedIndex;
I get an unhandled exception:
"Cross-thread operation not valid: Control 'cableGaugeSelect' accessed from a thread other than the thread it was created on."
It seems I have to use a delegate to get the data from between threads, but all of the examples I found of how to use delegates are of how to put text into a textbox. I am having a lot of trouble figuring out how to create a delegate that will retrieve this information. Any help would be appriciated