Category / Section
How to add a MDI Child from another MDI child in WinForms TabbedMDIManager?
1 min read
Add MDI child from another MDI child
For doing this the MdiParent property for the new child has to be set from another child form. Please refer the below code snippet which illustrates this.
C#
private void buttonAdv1_Click(object sender, EventArgs e) { Form3 child1 = new Form3(); // Set the new form's MDI parent to main form child1.MdiParent = (Form1)this.Parent.Parent; child1.Text = "Document"; child1.Show(); }
VB
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim f1 As Form3 = New Form3() ' Set the new form's MDI parent to main form f1.MdiParent = CType(Me.Parent.Parent, Form1) f1.Text = "Document" f1.Show() End Sub