I have 3 forms-Form1,2,3. Form1 is MdiContainer. Now, when a button on Form1 is clicked it shows Form2, and on Form2 when a button is clicked then it shows Form3. my code is as below but it gives error that Form2 is not MdiContainer. but if i make Form2 as MdiContainer then it gives error that Form2 is a MdiChild and can't be MdiContainer.
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
Form2 f2 = new Form2();
f2.Show();
f2.MdiParent = this;
}
}
public partial class Form2 : Form
{
public Form2()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
Form3 f3 = new Form3();
f3.Show();
f3.MdiParent = this;
}
}
how to do this?
In short , i want that : Parent of Form2 is Form1, and, Parent of Form3 is Form2