//When the help form is closed it's link points to a disposed object, we have to update our options form with a new one public void updateParentForm(Form form) { if (form is Form1) parentForm1 = (Form1)form; if (form is HelpForm) parentHelpForm = (HelpForm)form; }
//Passing main and help form links so that i know whose functions to call internal Options(Form1 parentForm1,HelpForm parentHelpForm,CombinePerformer CP) { this.parentForm1 = parentForm1; this.parentHelpForm = parentHelpForm; this.CP = CP; InitializeComponent(); }
public Form1() { InitializeComponent(); helpForm = new HelpForm(); optionsForm = new Options(this, helpForm,CP); }
// Display help private void helpButton_Click(object sender, EventArgs e) { if (!helpForm.Visible) { helpForm = new HelpForm(); optionsForm.updateParentForm(helpForm); } helpForm.Show(); }