Export (0) Print
Expand All

Form.MdiParent Property

Gets or sets the current multiple-document interface (MDI) parent form of this form.

Namespace:  System.Windows.Forms
Assembly:  System.Windows.Forms (in System.Windows.Forms.dll)

public Form MdiParent { get; set; }

Property Value

Type: System.Windows.Forms.Form
A Form that represents the MDI parent form.


The Form assigned to this property is not marked as an MDI container.


The Form assigned to this property is both a child and an MDI container form.


The Form assigned to this property is located on a different thread.

To create an MDI child form, assign the Form that will be the MDI parent form to the MdiParent property of the child form. You can use this property from an MDI child form to obtain global information that all child forms need or to invoke methods that perform actions to all child forms.


If there are two MenuStrip controls on an MDI child form, setting IsMdiContainer to true for the parent form merges the contents of only one of the MenuStrip controls. Use Merge to merge the contents of additional child MenuStrip controls on the MDI parent form.

The following code example demonstrates how to create child forms in an MDI application. The example code creates a form with unique text to identify the child form. The example uses the MdiParent property to specify that a form is a child form. This example requires that the code in the example is called from a form that has its IsMdiContainer property set to true and that the form has a private class level integer variable named childCount.

private void CreateMyChildForm ()
   // Create a new form to represent the child form.
   Form child = new Form();
   // Increment the private child count.
   // Set the text of the child form using the count of child forms.
   String formText = "Child " + childCount;
   child.Text = formText;

   // Make the new form a child form.
   child.MdiParent = this;
   // Display the child form.

Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

.NET Framework

Supported in: 3.5, 3.0, 2.0, 1.1, 1.0

Community Additions

© 2015 Microsoft