private void btnAddPlot_Click(object sender, EventArgs e) { if (lblJobIdVal.Text == "") { MessageBox.Show("You must select a Job before adding Plots!", "Warning!", MessageBoxButtons.OK); } else { frmAddJobPlot addPlotForm = new frmAddJobPlot(this); addPlotForm.ShowDialog(); } }
public frmPlot(Form callingForm) { Type frmType = callingForm.GetType(); switch (frmType.Name.ToLower()) { case "frmjobs": jobForm = callingForm as frmJobs; break; case "frmaddjobplot": mainForm = callingForm as frmAddJobPlot; break; } //mainForm = callingForm as frmAddJobPlot; if (jobForm != null) { selectedPlotID = jobForm.SelectedPlotId; selectedPlot = new Plot(selectedPlotID); } InitializeComponent(); }