我有一個問題,每當我刷新程序欄我得到的錯誤調用線程不能訪問此對象,因爲不同的線程擁有它 我該如何刪除它 沙善調用線程不能訪問此對象,因爲不同的線程擁有它
backgroundWorker12 = new BackgroundWorker();
timer1.Enabled = true;
//cancel any async processes running for the background worker
//backgroundWorker1.CancelAsync();
backgroundWorker12.DoWork += (s, args) =>
{
BackgroundWorker worker2 = s as BackgroundWorker;
worker2.WorkerReportsProgress = true;
float percentageDone = 20f;
//check if the user status and update the password in xml
CheckUseridPwd();
//call the function to sync the wall chart data
//call the function to sync event relate data
percentageDone = 100f;
ValidateLogin2(txtUserID.Text.Trim(), txtPassword.Password.Trim(), -1);
worker2.ReportProgress((int)percentageDone);
};`
工作很大,但是當我們在代碼的組合框結合上文中的數據,它會給同樣的錯誤 – Shashank 2010-06-30 08:59:19
@SHASHANK:我我害怕我不知道你的意思。綁定哪些數據?如上面哪個代碼 - 我的還是你的?你試圖在哪個線程中執行綁定? – 2010-06-30 09:16:11
對不起,我寫錯了 謝謝 – Shashank 2010-06-30 12:52:20