Please try to understand my need.
I have a project it has 3 froms.
Form1 is - MDI Parent
Form2 is - MDI Child
Form3 is - MDI child
I have already open the Form2 inside Form1(The parent form).
Form2 has a button.if clicked i want to open From3 inside the parent form(in my case it is Form1)
I already use the
Form2 form2 = new Form2();
from2.Mdiparent = this;
form2.show();
but i cant use the same code to open Form3 in the parent form(The parent form is Form1) because now i'm on the form2 so i can't use the key " this " am i correct?
please help me on this please.
Loading

VulpesRank #55 · 29.2K reputationPosted May 21, 2011, 2:25 AM EDT
Form3 f3 = new Form3();
f3.MdiParent = this.MdiParent; // 'this' refers to the current instance of Form2 and so Form3 will share the same parent, namely Form1
f3.Show();
Suthish NairRank #92 · 22.8K reputationPosted May 21, 2011, 2:28 AM EDT
Rudi Steelman11 reputationPosted May 21, 2011, 2:31 AM EDT
i'll check this and reply to u
Vilas GiteRank #951 · 2.1K reputationPosted May 21, 2011, 2:32 AM EDT
Are you want two forms will activated in a single button click?then its possible.
please ensure your MDI parent forms properties check it-IsMdiContainer=true;
private void button1_Click(object sender, EventArgs e)
{
Form2 frm2 = new Form2();
frm2.MdiParent = this;
frm2.Show();
Form3 frm3 = new Form3();
frm3.MdiParent = this;
frm3.Show();
}
-------------------------------------------------------------------
Checked Answer Box if, you solve your post........
Rudi Steelman11 reputationPosted May 21, 2011, 6:05 AM EDT
Vilas GiteRank #951 · 2.1K reputationPosted May 21, 2011, 6:45 AM EDT
The moto is that post became closed. :)