[This is preliminary documentation and is subject to change.]
Displays a message box with the specified text, caption, buttons, icon, default button, options, and Help button, using the specified Help file and Help keyword.
| C# | Visual Basic | Visual C++ |
DialogResult DisplayMessageBox( Form source, string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon, MessageBoxDefaultButton defaultButton, MessageBoxOptions options, string helpFilePath, string keyword )
Function DisplayMessageBox ( _ source As Form, _ text As String, _ caption As String, _ buttons As MessageBoxButtons, _ icon As MessageBoxIcon, _ defaultButton As MessageBoxDefaultButton, _ options As MessageBoxOptions, _ helpFilePath As String, _ keyword As String _ ) As DialogResult
DialogResult DisplayMessageBox( Form^ source, String^ text, String^ caption, MessageBoxButtons buttons, MessageBoxIcon icon, MessageBoxDefaultButton defaultButton, MessageBoxOptions options, String^ helpFilePath, String^ keyword )
- source (Form)
- The source form of the message.
- text (String)
- The text to display in the message box.
- caption (String)
- The text to display in the title bar of the message box.
- buttons (MessageBoxButtons)
- One of the MessageBoxButtons values that specifies which buttons to display in the message box.
- icon (MessageBoxIcon)
- One of the MessageBoxIcon values that specifies which icon to display in the message box.
- defaultButton (MessageBoxDefaultButton)
- One of the MessageBoxDefaultButton values that specifies the default button for the message box.
- options (MessageBoxOptions)
- One of the MessageBoxOptions values that specifies which display and association options will be used for the message box. You may pass in 0 if you wish to use the defaults.
- helpFilePath (String)
- The path and name of the Help file to display when the user clicks the Help button.
- keyword (String)
- The Help keyword to display when the user clicks the Help button.
One of the DialogResult values.
| Exception | Condition |
|---|---|
| InvalidEnumArgumentException |
buttons is not a member of MessageBoxButtons.-or- icon is not a member of MessageBoxIcon.-or- The defaultButton specified is not a member of MessageBoxDefaultButton. |
| InvalidOperationException | An attempt was made to display the MessageBox in a process that is not running in User Interactive mode. This is specified by the UserInteractive property. |
| ArgumentException |
options specified both DefaultDesktopOnly and ServiceNotification.-or- buttons specified an invalid combination of MessageBoxButtons. |