I need help with setting/changing the value of a label in my C# program whenever I try it an error occurs saying I need to cross thread it all. Can anyone write some code to
Try the following to update the value
label5.Invoke((MethodInvoker)(() => label5.Text = "Requested" + repeats + "Times"));
The Invoke method (from Control.Invoke
) will cause the passed in delegate to be run on the thread which the given Control
is affinitized to. In this case it will cause it to run on the GUI thread of your application and hence make the update safe.