Creating a Visual Basic MDI Form

From Techotopia
Revision as of 15:03, 23 July 2007 by Neil (Talk | contribs)

Jump to: navigation, search

Many of today's applications are designed using an MDI. Given this popularity it is not surprising that Visual Basic provides extensive support for developing MDI based applications. In this chapter of Visual Basic Essentials we will explain what an MDI is, and provide a detailed, step by step guide to developing MDI applications with Visual Basic.

What is an MDI?

The acronym MDI stands for Multi Document Interface. If you have ever used Microsoft Word or Excel the chances are you have used a multi-document interface. Multi-document interfaces consist of a parent form (also called a container) which contains other forms. For example, when more than one document is open in some versions of Microsoft Word, each document appears in its own form, contained within the parent form. The forms within the parent can be moved to any position within the parent form, but typically cannot be moved outside the confines of the parent.

The term MDI is actually misleading. A more accurate name would be multi-form interface or multi-window interface. The reason for this is that there is nothing that restricts the forms to containing just documents. In fact, a form in an MDI interface can contain anything that a form in a non-MDI interface can contain. In fact, recent version of Microsoft Office (specifically Office 2007) have moved away from the MDI approach. When multiple documents are opened in the Word 2007, for example, each document appears in an independent window. That said the MDI approach to user interface design is extremely useful and popular and a wide range of commercial applications are MDI based.

The following figure shows an application implemented using an MDI. Notice that all the forms are contained in the parent window:

File:Exampl.jpg