Export (0) Print
Expand All

Visual Basic Concepts

Visual Studio 6.0

Multiple-Document Interface (MDI) Applications

The multiple-document interface (MDI) allows you to create an application that maintains multiple forms within a single container form. Applications such as Microsoft Excel and Microsoft Word for Windows have multiple-document interfaces.

An MDI application allows the user to display multiple documents at the same time, with each document displayed in its own window. Documents or child windows are contained in a parent window, which provides a workspace for all the child windows in the application. For example, Microsoft Excel allows you to create and display multiple-document windows of different types. Each individual window is confined to the area of the Excel parent window. When you minimize Excel, all of the document windows are minimized as well; only the parent window's icon appears in the task bar.

A child form is an ordinary form that has its MDIChild property set to True. Your application can include many MDI child forms of similar or different types.

At run time, child forms are displayed within the workspace of the MDI parent form (the area inside the form's borders and below the title and menu bars). When a child form is minimized, its icon appears within the workspace of the MDI form instead of on the taskbar, as shown in Figure 6.4.

Figure 6.4   Child forms displayed within the workspace of the MDI form

Note   Your application can also include standard, non-MDI forms that are not contained in the MDI form. A typical use of a standard form in an MDI application is to display a modal dialog box.

An MDI form is similar to an ordinary form with one restriction. You can't place a control directly on a MDI form unless that control has an Align property (such as a picture box control) or has no visible interface (such as a timer control).

Creating an MDI Application

Use the following procedure to create an MDI form and its child forms.

To create an MDI application

  1. Create an MDI form.

    From the Project menu, choose Add MDI Form.

    Note   An application can have only one MDI form. If a project already has an MDI form, the Add MDI Form command on the Project menu is unavailable.

  2. Create the application's child forms.

    To create an MDI child form, create a new form (or open an existing one) and set its MDIChild property to True.

To learn more about MDI applications, see the following topics:

Show:
© 2014 Microsoft