MDI Help Needed
I have a parent form called 'MainForm' and two other children forms (switchboard and newcustomer). I created a menubar for 'MainForm' that includes a 'SwitchBoard' item. When I run the application and click the 'SwitchBoard' menu at the top, my switchboard appears , as a child, as it should.
Now, the switchboard itself contains a button called 'New Customer'. When I click this button, I want the new customer dialog to appear as a child of 'MainForm'.
The following event handler code is inside my SwitchBoard.cs file:
private void ncButton_Click(object sender, System.EventArgs e)
{
NewCustomer ncDialog = new NewCustomer();
MainForm parentForm = new MainForm();
ncDialog.MdiParent = parentForm;
ncDialog.Show();
}
But when the button is clicked nothing happens.
How can I get my new customer dialog to show as a child of 'MainForm'?
Thanks in advance!
|