Multithreading Errors in C#
- by Adam
Hi. I am trying to update a text box. I thought my threading code would fix the problem, but it does not. Can anyone help with this?
new Thread((ThreadStart)delegate { txtCapacitance.Text = Math.Round(capacitance, 3).ToString(); }).Start();
Gives the following error:
Cross-thread operation not valid:
Control 'txtCapacitance' accessed from
a thread other than the thread it was
created on.
Note that all this is being started by a dataReceived function which is called whenever USB data is received.