One way is for it to call bw_RunWorkerCompleted as follows:
private void RunBackgroundWorker() {
System.ComponentModel.BackgroundWorker bw = new System.ComponentModel.BackgroundWorker();
bw.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bw_RunWorkerCompleted);
bw.RunWorkerAsync();
}
void bw_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) {
MessageBox.Show(“Done”, “CAPTION”, MessageBoxButtons.OK, MessageBoxIcon.Information);
}
A more concise method it to call it inline:
private void RunBackgroundWorkerInline() {
System.ComponentModel.BackgroundWorker bwInline = new
System.ComponentModel.BackgroundWorker();
bwInline.RunWorkerCompleted += (s, ea) => { MessageBox.Show(“Done”, “CAPTION”,
MessageBoxButtons.OK, MessageBoxIcon.Information); };
bwInline.RunWorkerAsync();
}