I happen to get this Cross-Thread Error when trying to invoke a textbox from a different thread other than the main MMI Thread. I already understand why it happens.I would like your opinion about the way I am solving this. I am using this because I hate adding delegate declarations all over the code.
private void SetText(string text)
{
if (textBox1.InvokeRequired)
{
this.Invoke(new Action<string>(SetText), new object[]{ text });
}
else
{
this.textBox1.Text = text;
}
}
is this the right way to this ? is there a better and shorter way?