I have a ParentForm (FormMDI) and tow ChildForm : FormChild1, FormChild2
- Step1 : Open FormChild1 by Menu
FormChild1 f = new FormChild1();
f.MDIParent=this;
f.show();
- Step2 : On FormChild1 I have a button when clicked it can open FormChild2 but FormChild2 still inside FormMDI.
Detail:
In ParentForm:
Memuitem_clicked(sender,e)
{
FormChild1 f = new FormChild1();
f.MDIParent = this
f.show();
}
My first child (FormChild1) contain a button and event:
button1_clicked(sender,e)
{
FormChild2 f = new formChild();
f.MDIParent = ???//I want FormChild2 opened from here and it inside FormParent
f.show();
}
In VB.Net,I see can do this
hoangsamac
Posted Jun 25, 2007, 1:22 PM
I believe your creating your FormChild2 object reference wrong.
It should be:
button1_Clicked(Object sender, EventArgs e)
{
FormChild2 f = new FormChild2(); //Creates a reference to FormChild2
f.MDIParent = this.MDIParent; //Assigns the parent of "f" as the same parent of FormChild1
f.Show(); //Shows the new form in the parent MDIContainer
}
That should work, if it doesnt... at least I hope you get the concept :) Good luck!