我正在使用vb.net,並且在我的程序中,當我運行我的背景工具時會使此文本框啓用爲真,因此在我的程序中出現「crossthread operation not invalid」錯誤。我的主子將首先將啓用變爲false,當背景工作者運行時,它會將其恢復爲真,然後退出。爲什麼它給我一個錯誤? FYI:有更多的代碼,但我不想做任何更多的混亂...Crossthread操作無效... - VB.NET
這裏是堆棧跟蹤:
at System.Windows.Forms.Control.get_Handle()
at System.Windows.Forms.Control.OnEnabledChanged(EventArgs e)
at System.Windows.Forms.Control.set_Enabled(Boolean value)
at Helium.Form1.BackgroundWorker1_DoWork(Object sender, DoWorkEventArgs e) in C:\Users\Kevin\documents\visual studio 2010\Projects\Helium\Helium\Form1.vb:line 167
at System.ComponentModel.BackgroundWorker.OnDoWork(DoWorkEventArgs e)
at System.ComponentModel.BackgroundWorker.WorkerThreadStart(Object argument)
,這裏是確切的錯誤消息:
{"Cross-thread operation not valid: Control 'mainText' accessed from a thread other than the thread it was created on."}
有人可以幫我一把!
感謝,
凱文
我認爲該錯誤信息是不言自明。 – 2010-02-10 22:11:53