System.Windows.Forms.MessageBox.Show Method

Displays a message box with the specified text, caption, buttons, icon, default button, options, and Help button.

Syntax

public static DialogResult Show (string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon, MessageBoxDefaultButton defaultButton, MessageBoxOptions options, bool displayHelpButton)

Parameters

text
The text to display in the message box.
caption
The text to display in the title bar of the message box.
buttons
One of the System.Windows.Forms.MessageBoxButtons values that specifies which buttons to display in the message box.
icon
One of the System.Windows.Forms.MessageBoxIcon values that specifies which icon to display in the message box.
defaultButton
One of the System.Windows.Forms.MessageBoxDefaultButton values that specifies the default button for the message box.
options
One of the System.Windows.Forms.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.
displayHelpButton
true to show the Help button; otherwise, false. The default is false.

Returns

One of the System.Windows.Forms.DialogResult values.

Remarks

A message box is a modal dialog box, which means no input (keyboard or mouse click) can occur except to objects on the modal form. The program must hide or close a modal form (typically in response to some user action) before input to another form can occur.

When the user clicks the Help button, the form that owns the message box (or the active form) receives the Control.HelpRequested event. Handle the Control.HelpRequested event to perform custom Help actions.

Requirements

Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
Assembly Versions: 2.0.0.0