我在主窗體上顯示對話框,現在一個for循環正在工作後面,但是當該對話框將顯示代碼執行將停止,但我不想讓停止代碼的執行,是任何其他任何方式要做到這一點 ?Dialog停止執行代碼,是否有任何方式阻止它在C#中?
編輯:我現在使用的線程來做到這一點,我的代碼是一樣
Thread t;
private void StartParsingByLoop()
{
t = new Thread(new ThreadStart(RunProgress));
t.Start();
for (int i = 0; i < dialog.FileNames.Length; i++)
{
cNoteToParsed.AllContrctNotesFilePath.Add(dialog.FileNames[i].ToString());
}
cNoteToParsed.ParseContractNote();
if (cNoteToParsed.NOfContrctNoteParsed > 0)
LoadTransactionsInDataGridView();
t.Abort();
}
private void RunProgress()
{
frmProgress progressForImportingTran = new frmProgress("Importing Transactions", "ok");
progressForImportingTran.ShowDialog();
}
現在我的問題是,顯示進度對話框不會表現得像對話框,並給出了主要形式的訪問如果我們嘗試訪問主窗體,那麼對話框將隱藏。我不想讓對話被隱藏起來。
發佈一些代碼。 – 2010-10-21 10:27:48