The Difference Between an SDI Form & an MDI Form in Visual Basic

By Kevin Walker

The Visual Basic programming environment provides developers with a choice of user interface models for their applications, including the Single Document Interface and the Multiple Document Interface. Many modern applications use SDI, but you might find MDI more appropriate for programs or applications that use multiple user interface tabs. The newer Microsoft Foundation Class -- or MFC -- makes it easy to work with both SDI and MDI applications.

About SDI

Most applications use a Single Document Interface. Each window of the application holds a single document, so if the user wants to open more documents with that application, he must open a new window. It's also the default mode when building an application with Visual Basic. Windows Notepad is an example of a typical SDI application.

About MDI

Multiple Document Interfaces were popular in versions of Windows prior to Windows 95, but they've become less common. With an MDI, each window within an application holds multiple documents, usually in sub-windows. New documents open within the existing window and the information is shared with all other open documents. MDI applications include tabbed Web browsers, such as Mozilla Firefox, where users have the option to open documents in multiple tabs within the same window.

Advantages of SDI

An SDI interface works very well with multiple monitors and multiple virtual desktops. It also allows users to switch between multiple open documents using the native Windows taskbar and task manager, rather than through special code that you would need to write into your application.

Advantages of MDI

MDI applications can often handle multiple documents more readily than SDI programs. For example, many MDI text editors allow the user to open multiple text files side by side in the same window, making it easy to compare and look up information from a second document while working on the first.

Stability and Performance

SDI applications tend to be more robust and bug-free than MDI applications, since a serious error with one document rarely affects the other documents within an SDI environment. For example, if one Windows Notepad document crashes, any other open copies of Notepad will usually survive the crash. On the other hand, if one Web page in Firefox causes the browser to crash, all the open Web pages die with it. Nevertheless, MDI applications tend to perform more quickly than SDI programs, since only one version of the application is loaded into memory.