barski Posted April 22, 2004 Posted April 22, 2004 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?? Quote
wessamzeidan Posted April 22, 2004 Posted April 22, 2004 I'm not sure, but I think you have to show the parentContainer form first, since its the parent of chld3 form. Quote Proudly a Palestinian Microsoft ASP.NET MVP My Blog: wessamzeidan.net
*Experts* Nerseus Posted April 22, 2004 *Experts* Posted April 22, 2004 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 Quote "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
barski Posted April 22, 2004 Author Posted April 22, 2004 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!! Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.