void m_BackgroundWorker_VennCompleted(object sender, RunWorkerCompletedEventArgs e) { clsPlotResult mclsPlotResult; var mfrmVennDisplay = new frmVennDisplay(mclsVennPar); mfrmShowProgress.Hide(); mfrmShowProgress.DialogResult = DialogResult.Cancel; if (e.Error != null) { MessageBox.Show(e.Error.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } else if (e.Cancelled) { // Next, handle the case where the user canceled // the operation. // Note that due to a race condition in // the DoWork event handler, the Cancelled // flag may not have been set, even though // CancelAsync was called. Console.WriteLine("Canceled"); } else { // Finally, handle the case where the operation // succeeded. //mfrmPlot.Image = e.Result as Image; //DialogResult dres = mfrmPlot.ShowDialog(); mclsPlotResult = (clsPlotResult)e.Result; mfrmVennDisplay.Image = mclsPlotResult.mImage; mfrmVennDisplay.PlotName = mclsPlotResult.mstrPlotName; mfrmVennDisplay.DAnTEinstance = this; mfrmVennDisplay.MdiParent = m_frmDAnTE.MdiParent; mfrmVennDisplay.Title = "Venn Diagram"; mfrmVennDisplay.Show(); } }