I get the following error
Cross-thread operation not valid: Control accessed from a thread other than the thread it was created on.
This is a callback from a wcf.
I have a textBox and I need to update the value and appendtext to it. This value is coming back from another thread and updates the UI.
public CarStatus CarState
{
get
{
return _carState;
}
set
{
_carState;= value;
CarStatus tmpCarState;=null;
if (txtResult.InvokeRequired)
{
txtResult.Invoke(new MethodInvoker(() => { tmpCarState;=null;= _carState;}));
}
txtResult.AppendText(string.Format("Car status is: {0}{1}", tmpCarState, Environment.NewLine));
}
the following crashes!!