有2种方式来处理这个问题,以正确的方式和另一种方式:
1:如果你想有一个良好的工作解决方案那么这应该做的伎俩。 。
private void SetText(string text)
{
// InvokeRequired required compares the thread ID of the
// calling thread to the thread ID of the creating thread.
// If these threads are different, it returns true.
if (this.textBox1.InvokeRequired)
{
SetTextCallback d = new SetTextCallback(SetText);
this.Invoke(d, new object[] { text });
}
else
{
this.textBox1.Text = text;
}
}
msdn.microsoft.com/en-us/library/ms171728.aspx
2:但如果你想保证没有一个快速的解决方案,它会正常工作,只是设置这个变量: Control.CheckForIllegalCrossThreadCalls = False
ca你分享该异常的堆栈跟踪? – Arshad