我有一个用户控件和两个班我想打印我的Class1的结果为usercontrol.I是从类利用该线路发送结果用户控件抛出异常“跨线程操作无效”
((merge.MyControl)(MyControlInstance)).CLIDisplay = e.WorkItem.CustomerId;
我的控制属性显示的结果是
public string CLIDisplay
{
get { return lblResultCLI.Text; }
set
{
lblResultCLI.Text = value;
}
}
,但我得到以下情况例外,当我打电话一类我的C#形式
An exception of type 'System.InvalidOperationException' occurred in System.Windows.Forms.dll but was not handled in user code
Additional information: Cross-thread operation not valid: Control 'tbxEvents' accessed from a thread other than the thread it was created on.
你还没有解释你在线程方面做了什么,这显然很重要。你对这个错误做了什么研究? –
错误是关于'tbxEvents',这是代码中缺少的一种。 –
[Cross-thread operation not valid:可从其创建的线程以外的线程访问的控制]的可能重复(http://stackoverflow.com/questions/142003/cross-thread-operation-not-valid-control -ac-threads-other-than-the) – slugster