How do I work with MDI (multiple document interface) forms?

In an MDI application, there is a parent MDI form that contains MDI child windows, which are sub-windows within the main form. When you create a new MM .NET Windows Forms application, the MainForm class is set to be an MDI parent by default.

Creating an MDI Parent Form

To create an MDI parent form at design time:
  1. Set the form's IsMDIContainer property to true.

  2. Set the WindowState property to Maximized (optional). This causes the parent form to fill the computer desktop when instantiated.

For more information on creating a menu for the MDI Parent, see the .NET Help topic "Creating MDI Parent Forms".

Creating and Instantiating an MDI Child Form

There's nothing special you need to do when creating a new form that will be an MDI child. However, when instantiating an MDI child form from an MDI parent form, you need to add code to the MDI parent similar to the following:

In C#:

MyForm form = new MyForm();
form.MdiParent = this;
form.Show();


In Visual Basic .NET:

Dim form As New MyForm(Me)
form.MdiParent = Me
form.Show()


Note: If your application is localized, you should use the MM .NET Form Manager's Show and ShowDialog methods rather than calling these methods directly on the form. For details, see the MM .NET topic Showing Localized Windows Forms


© (c) 2026 Oak Leaf Enterprises, Inc., 1996-2026 • Updated: 04/26/18
Comment or report problem with topic