Multithreading 使用线程时获取跨线程错误
我对form1使用了两个窗体和一个线程,当form1的线程在运行时使用form2 two的数据时,我得到了一个错误Multithreading 使用线程时获取跨线程错误,multithreading,Multithreading,我对form1使用了两个窗体和一个线程,当form1的线程在运行时使用form2 two的数据时,我得到了一个错误 "system can not allow you to make cross threading!" 只需在form1 load中添加以下内容: private void Form1_Load(object sender, EventArgs e) { System.Windows.Forms.Control.CheckForIllegalCrossThrea
"system can not allow you to make cross threading!"
只需在form1 load中添加以下内容:
private void Form1_Load(object sender, EventArgs e)
{
System.Windows.Forms.Control.CheckForIllegalCrossThreadCalls = false;
}
你得到这个错误是因为表单有自己的线程在运行,这就是为什么当你的线程从Form 2线程中获取数据时,会产生中断和错误产生。汽车,这样它就再也不会有任何问题了。发布你的代码。还有,这是C吗?WPF还是WinForms?