Administrator

Administrator

  • Tech Writer
  • 2.2k
  • 1.5m

Child Form Load Question

Mar 12 2003 8:37 PM
I'm attempting to link my Child Forms to my MDIParent forms, however am having a bit of trouble completing this task. Okay for a foundation of this post in my main menu component I have a menu item named "mnuChartOfAccounts" and a Child Form named "frmChartOfAccounts". I want the mnuChartOfAccounts item to open the Child Form frmChartOfAccounts. Now according to the Visual Studio .NET provided help my code should look like this: protected void New_OnClick(object sender, System.EventArgs e) { //Create a new instance of Form2. Form2 NewMDIChild = new Form2(); //Set the parent of the new MDI child form. NewMDIChild.MDIParent = This; //Display the new MDI child form. NewMDIChild.Show(); } and If I understand correctly in the line "Form2 NewMDIChild = new Form2();" I should change this to read "Form2 NewMDIChild = new frmChartOfAccounts();" When I do this it gives me a error stating that frmChartOfAccounts is not a part of the provided name space. Also the click event for the menu item is not reading as "protected void New_OnClick(object sender, System.EventArgs e) it is reading as follows: private void mnuChartOfAccounts_Click(object sender, System.EventArgs e) Can someone please help with this matter? Thanks for all the help....... David Watson

Answers (1)