private void RunComplete(object sender, RunWorkerCompletedEventArgs e) { if (frmW != null) { frmW.Hide(); frmW = null; } }
private void btnProcess_Click(object sender, EventArgs e) { BackgroundWorker bw = new BackgroundWorker(); bw.DoWork += new DoWorkEventHandler(fnProcess); bw.RunWorkerCompleted += new RunWorkerCompletedEventHandler(RunComplete); frmW = new frmWait(); bw.RunWorkerAsync(); frmW.ShowDialog(); frmW = null; //fnProcess(); }