Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Opening an MDI child in the parent window

Status
Not open for further replies.

rexroth

Programmer
May 12, 2001
2
0
0
US
I'm a beginner and I can't find how to open an MDI Child in an MDI parent window. I like to use the GUI interface to create forms and set properties but all I can find in tutorials is ways to create forms programatically. I'm sure it's simple, I just can't find it.
 
It's pretty easy... In this instance, a menu creates a new instance of formMDIChild as myChildForm. Standard disclaimers apply... ;-)

Code:
private void menuOpenChild_Click(object sender, System.EventArgs e)
    {
        //declare and instantiate myChildForm as a new
        //instance of frmMDIChild
        frmMDIChild myChildForm = new frmMDIChild();

        //tell myChildForm that its parent object is
        //the object that contains my menu (i.e., "this")
        myChildForm.MdiParent = this;

        //now load and show it - badda-boom
        myChildForm.Show();
    }
Carter Wickstrom
wickerman26(at)hotmail(dot)com

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top