Visual Basic: CommonDialog Control

Visual Studio 6.0

CommonDialog Control

See Also   Example   Properties   Methods   Events

The CommonDialog control provides a standard set of dialog boxes for operations such as opening and saving files, setting print options, and selecting colors and fonts. The control also has the ability to display help by running the Windows Help engine.




The CommonDialog control provides an interface between Visual Basic and the routines in the Microsoft Windows dynamic-link library Commdlg.dll. To create a dialog box using this control, Commdlg.dll must be in your Microsoft Windows SYSTEM directory.

You use the CommonDialog control in your application by adding it to a form and setting its properties. The dialog displayed by the control is determined by the methods of the control. At run time, a dialog box is displayed or the help engine is executed, when the appropriate method is invoked; at design time, the CommonDialog control is displayed as an icon on a form. This icon can't be sized.

The CommonDialog control can display the following dialogs using the specified method.

Method Dialog Displayed
ShowOpen Show Open Dialog Box
ShowSave Show Save As Dialog Box
ShowColor Show Color Dialog Box
ShowFont Show Font Dialog Box
ShowPrinter Show Print or Print Options Dialog Box
ShowHelp Invokes the Windows Help Engine

The CommonDialog control automatically provides context sensitive help on the interface of the dialog boxes by clicking:

  • The What's This help button in the title bar then clicking the item for which you want more information.

  • The right mouse button over the item for which you want more information then selecting the What's This command in the displayed context menu.

The operating system provides the text shown in the Windows 95 (or later) Help popup. You can also display a Help button on the dialog boxes with the CommonDialog control by setting the Flags property, however, you must provide the help topics in this situation.

Note   There is no way to specify where a dialog box is displayed.

For More Information   To see help topics for each dialog, click on See Also.