Home » VB.NET MDI Form

VB.NET MDI Form

MDI stands for Multiple Document Interface applications that allow users to work with multiple documents by opening more than one document at a time. Whereas, a Single Document Interface (SDI) application can manipulate only one document at a time.

The MDI applications act as the parent and child relationship in a form. A parent form is a container that contains child forms, while child forms can be multiple to display different modules in a parent form.

VB.NET has folowing rules for creating a form as an MDI form.

  1. MidParent: The MidParent property is used to set a parent form to a child form.
  2. ActiveMdiChild: The ActiveMdiChild property is used to get the reference of the current child form.
  3. IsMdiContainer: The IsMdiContainer property set a Boolean value to True that represents the creation of a form as an MDI form.
  4. LayoutMdi(): The LayoutMdi() method is used to arrange the child forms in the parent or main form.
  5. Controls: It is used to get the reference of control from the child form.

Let’s create a program to display the multiple windows in the VB.NET Windows Forms.

Step 1: First, we have to open the Windows form and create the Menu bar with the use of MenuStrip control, as shown below.

VB.NET MDI Form

Step 2: After creating the Menu, add the Subitems into the Menu bar, as shown below.

VB.NET MDI Form

In the above image, we have defined two Subitems, First is the Feedback Form, and the Second is VB.NET.

Step 3: In the third step, we will create two Forms: The Child Form of the Main Form or Parent Form.

Here, we have created the first Child Form with the name Form2.

Form2.vb

Another Child Form with the name Form3.

Form3.vb

Step 4: Now we write the programming code for the Main or Parent Form, and here is the code for our Main Form.

MDI_form.vb

Output:

VB.NET MDI Form

After that, click on the Menu button, it shows two sub-items of the Menu as Feedback Form and VB.NET. We have clicked on the Feedback Form that displays the following form on the window.

VB.NET MDI Form

When we click on the Menu item, it shows the following image on the screen.

VB.NET MDI Form


Next TopicVB.NET Dialog Box

You may also like