Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

I need a child form to open another child form within the same parent. I don't get any errors when the code is executed but the form doesn't show.

 

 

Form2 chld3 = new Form2();

 

Home parentContainer = new Home();

chld3.MdiParent = parentContainer;

chld3.Show();

 

any ideas??

  • *Experts*
Posted

If you're within a child form's code (say a button click event on the child form) then you can just use the current child form's MDIParent property:

 

// chld3 will be the second child form to be shown

Form2 chld3 = new Form2();

chld3.MDIParent = this.MDIParent;

 

 

If you're within the MDI form when you want to show a new child form, then use "this":

Form2 chld3 = new Form2();

chld3.MDIParent = this;

 

 

-Nerseus

"I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut
Posted
If you're within a child form's code (say a button click event on the child form) then you can just use the current child form's MDIParent property:

 

// chld3 will be the second child form to be shown

Form2 chld3 = new Form2();

chld3.MDIParent = this.MDIParent;

 

 

If you're within the MDI form when you want to show a new child form, then use "this":

Form2 chld3 = new Form2();

chld3.MDIParent = this;

 

 

-Nerseus

 

Thank you!!

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...