Create a MDI Parent Form in VS 2008


Multiple-Document Interface (MDI) application is the MDI parent form. MDI applications must have at least two forms, the parent form and one or more child forms. In MDI you can make many child forms but only one parent Form. The Parent form is the MDI Form because its contains all child forms.

How To create an MDI parent form at design time

  1. Create a Windows Application project.

    • Start Visual Studio 2010.
    •  
    • On the File menu, Select new Project.
       
    • The New Project dialog box will come.
       
    • In the Installed Templates pane, Select Visual C#, and then select Windows.
       
    • Above the middle pane, select the target framework from the drop-down list.
       
    • In the middle pane, select the Windows Forms Application template.
       
    • In the Name text box, specify a name for the project like MDI Form.
       
    • In the Location text box, specify a folder to save the project.
       
    • Click OK.

  2. In the Properties window, set the ISMDIContainer property to true.

    MDI1.gif

    This designates the form as an MDI container for child windows.

  3. From the Toolbox, drag a MenuStrip component to the form. Create a top-level menu item with the Text property set to &File with submenu items called New, open, save and &Close.

    MDI2.gif

    And create a top-level menu item called Window and sub menu items called New Window, Open Window .

    MDI3.gif

    The first menu will create and hide menu items at run time, and the second menu will keep track of the open MDI child windows. At this point, you have created an MDI parent window.

  4. Press F5 to run the application.

    MDI4.gif

    In next article I will discuss about how to create MDI child forms.