我有一个用户控件和两个类我想将我的类 1 的结果打印到用户控件中。我正在使用这一行从类中发送结果
((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.