/// <summary> /// This assigns the instance property of the new child form to a variable called entryInstance, sets it as an MDI child and displays it. /// </summary> private void WindowNewCustomerEntry(object sender, EventArgs e) { // Create or call instance of the child below. formCustomerEntry entryInstance = formCustomerEntry.Instance; // Assign this child window an MdiParent entryInstance.MdiParent = this; // Display this instance and if it's already visible put focus on it. entryInstance.Show(); entryInstance.Focus(); }
/// <summary> /// When this form is closed, release the instance. /// </summary> private void CustomerFormClosed(object sender, FormClosedEventArgs e) { instance = null; }