Visual Basic Reference

MDIForm Object

See Also Example Properties Methods Events

An MDI (multiple-document interface) form is a window that acts as the background of an application and is the container for forms that have their MDIChild property set to True.




You create an MDIForm object by choosing MDI Form from the Insert menu.

An application can have only one MDIForm object but many MDI child forms. If an MDI child form has menus, the child form's menu bar automatically replaces the MDIForm object's menu bar when the MDI child form is active. A minimized MDI child form is displayed as an icon within the MDIForm.

An MDIForm object can contain only Menu and PictureBox controls and custom controls that have an Align property. To place other controls on an MDIForm, you can draw a picture box on the form, and then draw other controls inside the picture box. You can use the Print method to display text in a picture box on an MDIForm, but you can't use this method to display text on the MDIForm itself.

An MDIForm object can't be modal.

MDI child forms are designed independently of the MDIForm, but are always contained within the MDIForm at run time.

You can access the collection of controls on an MDIForm using the Controls collection. For example, to hide all the controls on an MDIForm you can use code similar to the following:

For Each Control in MDIForm1.Controls
   Control.Visible = False
Next Control

The Count property of the MDIForm tells you the number of controls in the Controls collection.