cad sunny

cad sunny

  • NA
  • 138
  • 22.8k

mdi between form1 and form3 ifi click form2 button

Mar 17 2020 12:46 PM
i have form1,form2 and form3.
form1 is my main mdi form.and also property set to ismdicontainer is true.
form1 buton click form 2 open
below code.
  1. private void button1_Click(object sender, EventArgs e)  
  2. {  
  3. Form2 f2 = new Form2();  
  4. f2.ShowDialog();  
  5. }  
if i click form 2 button i want to open form3 in form1 with mdiparent and form2 will be close.
here is my code form 2 button click code
  1. private void button1_Click(object sender, EventArgs e)  
  2. {  
  3. this.Hide();  
  4. Form3 f3 = new Form3();  
  5. f3.MdiParent = this.MdiParent;  
  6. f3.Show();  
  7. this.Close();  
  8. }  
but form2 closed but form 3 is not set mdiparent.
pls help

Answers (2)