- Message Box Класс
- Определение
- Примеры
- Комментарии
- Методы
- Message Box. Show Method
- Definition
- Overloads
- Show(String)
- Parameters
- Returns
- Examples
- Remarks
- Applies to
- Show(IWin32Window, String, String, MessageBoxButtons, MessageBoxIcon, MessageBoxDefaultButton, MessageBoxOptions, String, String)
- Parameters
- Returns
- Exceptions
- Examples
- Remarks
- See also
- Applies to
- Show(String, String, MessageBoxButtons, MessageBoxIcon, MessageBoxDefaultButton, MessageBoxOptions, String, HelpNavigator, Object)
- Parameters
- Returns
- Exceptions
- Examples
- Remarks
- See also
- Applies to
- Show(IWin32Window, String, String, MessageBoxButtons, MessageBoxIcon, MessageBoxDefaultButton, MessageBoxOptions, String)
- Parameters
- Returns
- Exceptions
- Examples
- Remarks
- See also
- Applies to
- Show(String, String, MessageBoxButtons, MessageBoxIcon, MessageBoxDefaultButton, MessageBoxOptions, String, HelpNavigator)
- Parameters
- Returns
- Exceptions
- Examples
- Remarks
- See also
- Applies to
- Show(String, String, MessageBoxButtons, MessageBoxIcon, MessageBoxDefaultButton, MessageBoxOptions, String, String)
- Parameters
- Returns
- Exceptions
- Examples
- Remarks
- See also
- Applies to
- Show(IWin32Window, String, String, MessageBoxButtons, MessageBoxIcon, MessageBoxDefaultButton, MessageBoxOptions)
- Parameters
- Returns
- Exceptions
- Examples
- Remarks
- See also
- Applies to
- Show(String, String, MessageBoxButtons, MessageBoxIcon, MessageBoxDefaultButton, MessageBoxOptions, String)
- Parameters
- Returns
- Exceptions
- Examples
- Remarks
- See also
- Applies to
- Show(String, String, MessageBoxButtons, MessageBoxIcon, MessageBoxDefaultButton, MessageBoxOptions, Boolean)
- Parameters
- Returns
- Exceptions
- Examples
- Remarks
- See also
- Applies to
- Show(IWin32Window, String, String, MessageBoxButtons, MessageBoxIcon, MessageBoxDefaultButton, MessageBoxOptions, String, HelpNavigator)
- Parameters
- Returns
- Exceptions
- Examples
- Remarks
- See also
- Applies to
- Show(IWin32Window, String, String, MessageBoxButtons, MessageBoxIcon, MessageBoxDefaultButton)
- Parameters
- Returns
- Exceptions
- Examples
- Remarks
- See also
- Applies to
- Show(IWin32Window, String, String, MessageBoxButtons, MessageBoxIcon)
- Parameters
- Returns
- Exceptions
- Examples
- Remarks
- See also
- Applies to
- Show(String, String, MessageBoxButtons, MessageBoxIcon, MessageBoxDefaultButton)
- Parameters
- Returns
- Exceptions
- Examples
- Remarks
- See also
- Applies to
- Show(IWin32Window, String, String, MessageBoxButtons)
- Parameters
- Returns
- Exceptions
- Examples
- Remarks
- See also
- Applies to
- Show(String, String, MessageBoxButtons, MessageBoxIcon)
- Parameters
- Returns
- Exceptions
- Examples
- Remarks
- See also
- Applies to
- Show(IWin32Window, String, String)
- Parameters
- Returns
- Remarks
- Applies to
- Show(String, String, MessageBoxButtons)
- Parameters
- Returns
- Exceptions
- Examples
- Remarks
- See also
- Applies to
- Show(IWin32Window, String)
- Parameters
- Returns
- Remarks
- Applies to
- Show(String, String)
- Parameters
- Returns
- Remarks
- Applies to
- Show(String, String, MessageBoxButtons, MessageBoxIcon, MessageBoxDefaultButton, MessageBoxOptions)
- Parameters
- Returns
- Exceptions
- Examples
- Remarks
- See also
- Applies to
- Show(IWin32Window, String, String, MessageBoxButtons, MessageBoxIcon, MessageBoxDefaultButton, MessageBoxOptions, String, HelpNavigator, Object)
- Parameters
- Returns
- Exceptions
- Examples
- Remarks
Message Box Класс
Определение
Отображает окно сообщения (диалоговое окно) с текстом для пользователя. Displays a message window, also known as a dialog box, which presents a message to the user. Это модальное окно, блокирующее другие действия в приложении, пока пользователь не закроет его. It is a modal window, blocking other actions in the application until the user closes it. MessageBox может содержать текст, кнопки и символы для отображения пользователю информации и инструкций. A MessageBox can contain text, buttons, and symbols that inform and instruct the user.
Примеры
В следующем примере кода показано, как использовать объект MessageBox для информирования пользователя об отсутствующей записи в TextBox . The following code example shows how to use a MessageBox to inform the user of a missing entry in a TextBox. Для этого примера требуется, чтобы метод вызывался из существующей формы с TextBox именем ServerName . This example requires that the method is called from an existing form with a TextBox named ServerName on it.
В следующем примере кода показано, как задать пользователю да или нет вопроса и принять решение, основанное на ответе. The following code example shows how to ask the user a yes or no question and make a decision based on the response.
Комментарии
Нельзя создать новый экземпляр MessageBox класса. You cannot create a new instance of the MessageBox class. Чтобы отобразить окно сообщения, вызовите static метод MessageBox.Show . To display a message box, call the static method MessageBox.Show. Заголовок, сообщение, кнопки и значки, отображаемые в окне сообщения, определяются параметрами, передаваемыми этому методу. The title, message, buttons, and icons displayed in the message box are determined by parameters that you pass to this method.
Методы
Определяет, равен ли указанный объект текущему объекту. Determines whether the specified object is equal to the current object.
(Унаследовано от Object)
Служит хэш-функцией по умолчанию. Serves as the default hash function.
(Унаследовано от Object)
Возвращает объект Type для текущего экземпляра. Gets the Type of the current instance.
(Унаследовано от Object)
Создает неполную копию текущего объекта Object. Creates a shallow copy of the current Object.
(Унаследовано от Object)
Отображает перед заданным объектом окно сообщения, содержащее заданный текст. Displays a message box in front of the specified object and with the specified text.
Отображает перед заданным объектом окно сообщения, содержащее заданный текст и заголовок. Displays a message box in front of the specified object and with the specified text and caption.
Отображает перед заданным объектом окно сообщения, содержащее заданный текст, заголовок и кнопки. Displays a message box in front of the specified object and with the specified text, caption, and buttons.
Отображает перед заданным объектом окно сообщения, содержащее заданный текст, заголовок, кнопки и значок. Displays a message box in front of the specified object and with the specified text, caption, buttons, and icon.
Отображает перед заданным объектом окно сообщения, содержащее заданный текст, заголовок, кнопки, значок и кнопку по умолчанию. Displays a message box in front of the specified object and with the specified text, caption, buttons, icon, and default button.
Отображает перед заданным объектом окно сообщения, содержащее заданный текст, заголовок, кнопки, значок, кнопку по умолчанию и параметры. Displays a message box in front of the specified object and with the specified text, caption, buttons, icon, default button, and options.
Отображает окно сообщения с заданным текстом, заголовком, кнопками, значком, кнопкой по умолчанию, параметрами для выбора, кнопкой «Справка», используя заданный файл справки. Displays a message box with the specified text, caption, buttons, icon, default button, options, and Help button, using the specified Help file.
Отображает окно сообщения с заданным текстом, заголовком, кнопками, значком, кнопкой по умолчанию, параметрами для выбора, кнопкой «Справка», используя заданный файл справки и HelpNavigator . Displays a message box with the specified text, caption, buttons, icon, default button, options, and Help button, using the specified Help file and HelpNavigator .
Отображает окно сообщения с заданным текстом, заголовком, кнопками, значком, кнопкой по умолчанию, параметрами для выбора, кнопкой «Справка», используя заданный файл справки, HelpNavigator и раздел справки. Displays a message box with the specified text, caption, buttons, icon, default button, options, and Help button, using the specified Help file, HelpNavigator , and Help topic.
Отображает окно сообщения с заданным текстом, заголовком, кнопками, значком, кнопкой по умолчанию, параметрами для выбора, кнопкой «Справка», используя заданный файл справки и Ключевое слово справки. 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.
Отображает окно сообщения с заданным текстом. Displays a message box with specified text.
Отображает окно сообщения с заданным текстом и заголовком. Displays a message box with specified text and caption.
Отображает окно сообщения с заданным текстом, заголовком и кнопками. Displays a message box with specified text, caption, and buttons.
Отображает окно сообщения с заданным текстом, заголовком, кнопками и значком. Displays a message box with specified text, caption, buttons, and icon.
Отображает окно сообщения с заданным текстом, заголовком, кнопками, значком и кнопкой по умолчанию. Displays a message box with the specified text, caption, buttons, icon, and default button.
Отображает окно сообщения с заданным текстом, заголовком, кнопками, значком, кнопкой по умолчанию и параметрами для выбора. Displays a message box with the specified text, caption, buttons, icon, default button, and options.
Отображает окно сообщения с заданным текстом, заголовком, кнопками, значком, кнопкой по умолчанию, параметрами для выбора и кнопкой «Справка». Displays a message box with the specified text, caption, buttons, icon, default button, options, and Help button.
Отображает окно сообщения с заданным текстом, заголовком, кнопками, значком, кнопкой по умолчанию, параметрами для выбора, кнопкой «Справка», используя заданный файл справки. Displays a message box with the specified text, caption, buttons, icon, default button, options, and Help button, using the specified Help file.
Отображает окно сообщения с заданным текстом, заголовком, кнопками, значком, кнопкой по умолчанию, параметрами для выбора, кнопкой «Справка», используя заданный файл справки и HelpNavigator . Displays a message box with the specified text, caption, buttons, icon, default button, options, and Help button, using the specified Help file and HelpNavigator .
Отображает окно сообщения с заданным текстом, заголовком, кнопками, значком, кнопкой по умолчанию, параметрами для выбора, кнопкой «Справка», используя заданный файл справки, HelpNavigator и раздел справки. Displays a message box with the specified text, caption, buttons, icon, default button, options, and Help button, using the specified Help file, HelpNavigator , and Help topic.
Отображает окно сообщения с заданным текстом, заголовком, кнопками, значком, кнопкой по умолчанию, параметрами для выбора, кнопкой «Справка», используя заданный файл справки и Ключевое слово справки. 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.
Возвращает строку, представляющую текущий объект. Returns a string that represents the current object.
Message Box. Show Method
Definition
Displays a message box.
Overloads
Displays a message box with specified text.
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.
Displays a message box with the specified text, caption, buttons, icon, default button, options, and Help button, using the specified Help file, HelpNavigator , and Help topic.
Displays a message box with the specified text, caption, buttons, icon, default button, options, and Help button, using the specified Help file.
Displays a message box with the specified text, caption, buttons, icon, default button, options, and Help button, using the specified Help file and HelpNavigator .
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.
Displays a message box in front of the specified object and with the specified text, caption, buttons, icon, default button, and options.
Displays a message box with the specified text, caption, buttons, icon, default button, options, and Help button, using the specified Help file.
Displays a message box with the specified text, caption, buttons, icon, default button, options, and Help button.
Displays a message box with the specified text, caption, buttons, icon, default button, options, and Help button, using the specified Help file and HelpNavigator .
Displays a message box in front of the specified object and with the specified text, caption, buttons, icon, and default button.
Displays a message box in front of the specified object and with the specified text, caption, buttons, and icon.
Displays a message box with the specified text, caption, buttons, icon, and default button.
Displays a message box in front of the specified object and with the specified text, caption, and buttons.
Displays a message box with specified text, caption, buttons, and icon.
Displays a message box in front of the specified object and with the specified text and caption.
Displays a message box with specified text, caption, and buttons.
Displays a message box in front of the specified object and with the specified text.
Displays a message box with specified text and caption.
Displays a message box with the specified text, caption, buttons, icon, default button, and options.
Displays a message box with the specified text, caption, buttons, icon, default button, options, and Help button, using the specified Help file, HelpNavigator , and Help topic.
Show(String)
Displays a message box with specified text.
Parameters
The text to display in the message box.
Returns
One of the DialogResult values.
Examples
The following code example displays a simple message box.
Remarks
By default, the message box displays an OK button. The message box does not contain a caption in the title.
Applies to
Show(IWin32Window, String, String, MessageBoxButtons, MessageBoxIcon, MessageBoxDefaultButton, MessageBoxOptions, String, String)
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.
Parameters
An implementation of IWin32Window that will own the modal dialog box.
The text to display in the message box.
The text to display in the title bar of the message box.
One of the MessageBoxButtons values that specifies which buttons to display in the message box.
One of the MessageBoxIcon values that specifies which icon to display in the message box.
One of the MessageBoxDefaultButton values that specifies the default button for the message box.
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.
The path and name of the Help file to display when the user clicks the Help button.
The Help keyword to display when the user clicks the Help button.
Returns
One of the DialogResult values.
Exceptions
buttons is not a member of MessageBoxButtons.
icon is not a member of MessageBoxIcon.
The defaultButton specified is not a member of MessageBoxDefaultButton.
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.
buttons specified an invalid combination of MessageBoxButtons.
Examples
The following code example demonstrates how to show a message box parented to the main window. The message box displays a Help button. When the user clicks the Help button, the Mspaint.chm Help file is opened and the topic identified by the mspaint.chm::/paint_brush.htm keyword is displayed. The example requires that the Mspaint.chm Help file is installed.
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. You can use the owner parameter to specify a particular object, which implements the IWin32Window interface, that will serve as the dialog box’s top-level owner.
When the user clicks the Help button, the Help file specified in the helpFilePath parameter is opened and the Help keyword topic identified by the keyword parameter is displayed. The form that owns the message box (or the active form) also receives the HelpRequested event.
See also
Applies to
Show(String, String, MessageBoxButtons, MessageBoxIcon, MessageBoxDefaultButton, MessageBoxOptions, String, HelpNavigator, Object)
Displays a message box with the specified text, caption, buttons, icon, default button, options, and Help button, using the specified Help file, HelpNavigator , and Help topic.
Parameters
The text to display in the message box.
The text to display in the title bar of the message box.
One of the MessageBoxButtons values that specifies which buttons to display in the message box.
One of the MessageBoxIcon values that specifies which icon to display in the message box.
One of the MessageBoxDefaultButton values that specifies the default button for the message box.
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.
The path and name of the Help file to display when the user clicks the Help button.
One of the HelpNavigator values.
The numeric ID of the Help topic to display when the user clicks the Help button.
Returns
One of the DialogResult values.
Exceptions
buttons is not a member of MessageBoxButtons.
icon is not a member of MessageBoxIcon.
The defaultButton specified is not a member of MessageBoxDefaultButton.
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.
buttons specified an invalid combination of MessageBoxButtons.
Examples
The following code example demonstrates how to show a message box with a Help button. When the user clicks the Help button, the Mspaint.chm Help file is opened and the Help index tab and the topic identified by the ovals keyword are displayed. The example requires that the Mspaint.chm Help file is installed.
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 Help file specified in the helpFilePath parameter is opened and the Help content identified by the navigator parameter is displayed. The form that owns the message box (or the active form) also receives the HelpRequested event.
Compiled help files provide table of contents, index, search, and keyword links in pages. You can use the following values for navigator : TableOfContents, Find, Index, or Topic.
You can use param to provide further refinement of the Topic command. If the value specified in the navigator parameter is TableOfContents, Index, or Find, this value should be null . If the navigator parameter references Topic, this value should reference an object that contains the numeric value of the topic to display.
The helpFilePath parameter can be of the form C:\path\sample.chm or /folder/file.htm.
See also
Applies to
Show(IWin32Window, String, String, MessageBoxButtons, MessageBoxIcon, MessageBoxDefaultButton, MessageBoxOptions, String)
Displays a message box with the specified text, caption, buttons, icon, default button, options, and Help button, using the specified Help file.
Parameters
An implementation of IWin32Window that will own the modal dialog box.
The text to display in the message box.
The text to display in the title bar of the message box.
One of the MessageBoxButtons values that specifies which buttons to display in the message box.
One of the MessageBoxIcon values that specifies which icon to display in the message box.
One of the MessageBoxDefaultButton values that specifies the default button for the message box.
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.
The path and name of the Help file to display when the user clicks the Help button.
Returns
One of the DialogResult values.
Exceptions
buttons is not a member of MessageBoxButtons.
icon is not a member of MessageBoxIcon.
The defaultButton specified is not a member of MessageBoxDefaultButton.
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.
buttons specified an invalid combination of MessageBoxButtons.
Examples
The following code example demonstrates how to show a message box that parented to the main form. The message box displays a Help button. When the user clicks the Help button, the Mspaint.chm Help file is opened. The example requires that the Mspaint.chm Help file is installed.
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. You can use the owner parameter to specify a particular object, which implements the IWin32Window interface, that will serve as the dialog box’s top-level window and owner.
When the user clicks the Help button, the Help file specified in the helpFilePath parameter is opened. The form that owns the message box (or the active form) also receives the HelpRequested event.
The helpFilePath parameter can be of the form C:\path\sample.chm or /folder/file.htm.
See also
Applies to
Show(String, String, MessageBoxButtons, MessageBoxIcon, MessageBoxDefaultButton, MessageBoxOptions, String, HelpNavigator)
Displays a message box with the specified text, caption, buttons, icon, default button, options, and Help button, using the specified Help file and HelpNavigator .
Parameters
The text to display in the message box.
The text to display in the title bar of the message box.
One of the MessageBoxButtons values that specifies which buttons to display in the message box.
One of the MessageBoxIcon values that specifies which icon to display in the message box.
One of the MessageBoxDefaultButton values that specifies the default button for the message box.
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.
The path and name of the Help file to display when the user clicks the Help button.
One of the HelpNavigator values.
Returns
One of the DialogResult values.
Exceptions
buttons is not a member of MessageBoxButtons.
icon is not a member of MessageBoxIcon.
The defaultButton specified is not a member of MessageBoxDefaultButton.
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.
buttons specified an invalid combination of MessageBoxButtons.
Examples
The following code example demonstrates how to show a message box with a Help button. When the user clicks the Help button, the Mspaint.chm Help file is opened and the Help index tab is displayed. The example requires that the Mspaint.chm Help file is installed.
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 help file specified in the helpFilePath parameter is opened and the Help content identified by the navigator parameter is displayed. The form that owns the message box (or the active form) also receives the HelpRequested event.
Compiled Help files provide table of contents, index, search, and keyword links in pages. You can use the following values for navigator : TableOfContents, Find, Index, or Topic.
The helpFilePath parameter can be of the form C:\path\sample.chm or /folder/file.htm.
See also
Applies to
Show(String, String, MessageBoxButtons, MessageBoxIcon, MessageBoxDefaultButton, MessageBoxOptions, String, String)
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.
Parameters
The text to display in the message box.
The text to display in the title bar of the message box.
One of the MessageBoxButtons values that specifies which buttons to display in the message box.
One of the MessageBoxIcon values that specifies which icon to display in the message box.
One of the MessageBoxDefaultButton values that specifies the default button for the message box.
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.
The path and name of the Help file to display when the user clicks the Help button.
The Help keyword to display when the user clicks the Help button.
Returns
One of the DialogResult values.
Exceptions
buttons is not a member of MessageBoxButtons.
icon is not a member of MessageBoxIcon.
The defaultButton specified is not a member of MessageBoxDefaultButton.
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.
buttons specified an invalid combination of MessageBoxButtons.
Examples
The following code example demonstrates how to show a message box with a Help button. When the user clicks the Help button, the Mspaint.chm Help file is opened and the topic identified by the mspaint.chm::/paint_brush.htm keyword is displayed. The example requires that the Mspaint.chm Help file is installed.
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 Help file specified in the helpFilePath parameter is opened and the Help keyword topic identified by the keyword parameter is displayed. The form that owns the message box (or the active form) also receives the HelpRequested event.
See also
Applies to
Show(IWin32Window, String, String, MessageBoxButtons, MessageBoxIcon, MessageBoxDefaultButton, MessageBoxOptions)
Displays a message box in front of the specified object and with the specified text, caption, buttons, icon, default button, and options.
Parameters
An implementation of IWin32Window that will own the modal dialog box.
The text to display in the message box.
The text to display in the title bar of the message box.
One of the MessageBoxButtons values that specifies which buttons to display in the message box.
One of the MessageBoxIcon values that specifies which icon to display in the message box.
One of the MessageBoxDefaultButton values the specifies the default button for the message box.
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.
Returns
One of the DialogResult values.
Exceptions
buttons is not a member of MessageBoxButtons.
icon is not a member of MessageBoxIcon.
defaultButton is not a member of MessageBoxDefaultButton.
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.
options specified DefaultDesktopOnly or ServiceNotification and specified a value in the owner parameter. These two options should be used only if you invoke the version of this method that does not take an owner parameter.
buttons specified an invalid combination of MessageBoxButtons.
Examples
The following code example demonstrates how to display a MessageBox with the options supported by this overload of Show. After verifying that a string variable, ServerName , is empty, the example displays a MessageBox, offering the user the option to cancel the operation. If the Show method’s return value evaluates to Yes, the form that displayed the MessageBox is closed.
Remarks
You can use the owner parameter to specify a particular object, which implements the IWin32Window interface, that will serve as the dialog box’s top-level window and owner. 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.
You can have a maximum of three buttons on the message box.
See also
Applies to
Show(String, String, MessageBoxButtons, MessageBoxIcon, MessageBoxDefaultButton, MessageBoxOptions, String)
Displays a message box with the specified text, caption, buttons, icon, default button, options, and Help button, using the specified Help file.
Parameters
The text to display in the message box.
The text to display in the title bar of the message box.
One of the MessageBoxButtons values that specifies which buttons to display in the message box.
One of the MessageBoxIcon values that specifies which icon to display in the message box.
One of the MessageBoxDefaultButton values that specifies the default button for the message box.
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.
The path and name of the Help file to display when the user clicks the Help button.
Returns
One of the DialogResult values.
Exceptions
buttons is not a member of MessageBoxButtons.
icon is not a member of MessageBoxIcon.
The defaultButton specified is not a member of MessageBoxDefaultButton.
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.
buttons specified an invalid combination of MessageBoxButtons.
Examples
The following code example demonstrates how to show a message box with a Help button. When the user clicks the Help button, the Mspaint.chm Help file is opened. The example requires that the Mspaint.chm Help file is installed.
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 Help button, the Help file specified in the helpFilePath parameter is opened. The form that owns the message box (or the active form) also receives the HelpRequested event.
The helpFilePath parameter can be of the form C:\path\sample.chm or /folder/file.htm.
See also
Applies to
Show(String, String, MessageBoxButtons, MessageBoxIcon, MessageBoxDefaultButton, MessageBoxOptions, Boolean)
Displays a message box with the specified text, caption, buttons, icon, default button, options, and Help button.
Parameters
The text to display in the message box.
The text to display in the title bar of the message box.
One of the MessageBoxButtons values that specifies which buttons to display in the message box.
One of the MessageBoxIcon values that specifies which icon to display in the message box.
One of the MessageBoxDefaultButton values that specifies the default button for the message box.
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.
true to show the Help button; otherwise, false . The default is false .
Returns
One of the DialogResult values.
Exceptions
buttons is not a member of MessageBoxButtons.
icon is not a member of MessageBoxIcon.
The defaultButton specified is not a member of MessageBoxDefaultButton.
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.
buttons specified an invalid combination of MessageBoxButtons.
Examples
The following code example demonstrates how to show a message box with a Help button, handle the Control.HelpRequested event, and show a custom help window in response to the event.
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 HelpRequested event. Handle the HelpRequested event to perform custom Help actions.
See also
Applies to
Show(IWin32Window, String, String, MessageBoxButtons, MessageBoxIcon, MessageBoxDefaultButton, MessageBoxOptions, String, HelpNavigator)
Displays a message box with the specified text, caption, buttons, icon, default button, options, and Help button, using the specified Help file and HelpNavigator .
Parameters
An implementation of IWin32Window that will own the modal dialog box.
The text to display in the message box.
The text to display in the title bar of the message box.
One of the MessageBoxButtons values that specifies which buttons to display in the message box.
One of the MessageBoxIcon values that specifies which icon to display in the message box.
One of the MessageBoxDefaultButton values that specifies the default button for the message box.
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.
The path and name of the Help file to display when the user clicks the Help button.
One of the HelpNavigator values.
Returns
One of the DialogResult values.
Exceptions
buttons is not a member of MessageBoxButtons.
icon is not a member of MessageBoxIcon.
The defaultButton specified is not a member of MessageBoxDefaultButton.
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.
buttons specified an invalid combination of MessageBoxButtons.
Examples
The following code example demonstrates how to show a message box parented to the main window. The message box displays a Help button. When the user clicks the Help button, the Mspaint.chm Help file is opened and the Help index tab is displayed. The example requires that the Mspaint.chm Help file is installed.
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. You can use the owner parameter to specify a particular object, which implements the IWin32Window interface, that will serve as the dialog box’s top-level window and owner.
When the user clicks the Help button, the Help file specified in the helpFilePath parameter is opened and the Help content identified by the navigator parameter is displayed. The form that owns the message box (or the active form) also receives the HelpRequested event.
Compiled Help files provide table of contents, index, search, and keyword links in pages. You can use the following values for navigator : TableOfContents, Find, Index, or Topic.
The helpFilePath parameter can be of the form C:\path\sample.chm or /folder/file.htm.
See also
Applies to
Show(IWin32Window, String, String, MessageBoxButtons, MessageBoxIcon, MessageBoxDefaultButton)
Displays a message box in front of the specified object and with the specified text, caption, buttons, icon, and default button.
Parameters
An implementation of IWin32Window that will own the modal dialog box.
The text to display in the message box.
The text to display in the title bar of the message box.
One of the MessageBoxButtons values that specifies which buttons to display in the message box.
One of the MessageBoxIcon values that specifies which icon to display in the message box.
One of the MessageBoxDefaultButton values that specifies the default button for the message box.
Returns
One of the DialogResult values.
Exceptions
buttons is not a member of MessageBoxButtons.
icon is not a member of MessageBoxIcon.
defaultButton is not a member of MessageBoxDefaultButton.
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.
Examples
The following code example demonstrates how to display a MessageBox with the options supported by this overload of Show. After verifying that a string variable, ServerName , is empty, the example displays a MessageBox, offering the user the option to cancel the operation. If the Show method’s return value evaluates to Yes, the form that displayed the MessageBox is closed.
Remarks
You can use the owner parameter to specify a particular object, which implements the IWin32Window interface, that will serve as the dialog box’s top-level window and owner. 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.
You can have a maximum of three buttons on the message box.
See also
Applies to
Show(IWin32Window, String, String, MessageBoxButtons, MessageBoxIcon)
Displays a message box in front of the specified object and with the specified text, caption, buttons, and icon.
Parameters
An implementation of IWin32Window that will own the modal dialog box.
The text to display in the message box.
The text to display in the title bar of the message box.
One of the MessageBoxButtons values that specifies which buttons to display in the message box.
One of the MessageBoxIcon values that specifies which icon to display in the message box.
Returns
One of the DialogResult values.
Exceptions
buttons is not a member of MessageBoxButtons.
icon is not a member of MessageBoxIcon.
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.
Examples
The following code example demonstrates how to display a MessageBox with the options supported by this overload of Show. After verifying that a string variable, ServerName , is empty, the example displays a MessageBox, offering the user the option to cancel the operation. If the Show method’s return value evaluates to Yes, the form that displayed the MessageBox is closed.
Remarks
You can use the owner parameter to specify a particular object, which implements the IWin32Window interface, that will serve as the dialog box’s top-level window and owner. 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.
You can have a maximum of three buttons on the message box.
See also
Applies to
Show(String, String, MessageBoxButtons, MessageBoxIcon, MessageBoxDefaultButton)
Displays a message box with the specified text, caption, buttons, icon, and default button.
Parameters
The text to display in the message box.
The text to display in the title bar of the message box.
One of the MessageBoxButtons values that specifies which buttons to display in the message box.
One of the MessageBoxIcon values that specifies which icon to display in the message box.
One of the MessageBoxDefaultButton values that specifies the default button for the message box.
Returns
One of the DialogResult values.
Exceptions
buttons is not a member of MessageBoxButtons.
icon is not a member of MessageBoxIcon.
defaultButton is not a member of MessageBoxDefaultButton.
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.
Examples
The following code example demonstrates how to display a MessageBox with the options supported by this overload of Show. After verifying that a string variable, ServerName , is empty, the example displays a MessageBox with a question box icon, offering the user the option to cancel the operation. If the Show method’s return value evaluates to Yes, the form that displayed the MessageBox is closed.
Remarks
You can have a maximum of three buttons on the message box.
See also
Applies to
Show(IWin32Window, String, String, MessageBoxButtons)
Displays a message box in front of the specified object and with the specified text, caption, and buttons.
Parameters
An implementation of IWin32Window that will own the modal dialog box.
The text to display in the message box.
The text to display in the title bar of the message box.
One of the MessageBoxButtons values that specifies which buttons to display in the message box.
Returns
One of the DialogResult values.
Exceptions
buttons is not a member of MessageBoxButtons.
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.
Examples
The following code example demonstrates how to display a MessageBox with the options supported by this overload of Show. After verifying that a string variable, ServerName , is empty, the example displays a MessageBox, offering the user the option to cancel the operation. If the Show method’s return value evaluates to Yes, the form that displayed the MessageBox is closed.
Remarks
You can use the owner parameter to specify a particular object, which implements the IWin32Window interface, that will serve as the dialog box’s top-level window and owner. 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.
You can have a maximum of three buttons on the message box.
See also
Applies to
Show(String, String, MessageBoxButtons, MessageBoxIcon)
Displays a message box with specified text, caption, buttons, and icon.
Parameters
The text to display in the message box.
The text to display in the title bar of the message box.
One of the MessageBoxButtons values that specifies which buttons to display in the message box.
One of the MessageBoxIcon values that specifies which icon to display in the message box.
Returns
One of the DialogResult values.
Exceptions
The buttons parameter specified is not a member of MessageBoxButtons.
The icon parameter specified is not a member of MessageBoxIcon.
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.
Examples
The following code example demonstrates one of the Show methods when handling the ComboBox.DropDown event. To run the example, paste the following code in a form and call the InitializeComboBox method from the form’s constructor or Load method.
Remarks
You can have a maximum of three buttons on the message box.
See also
Applies to
Show(IWin32Window, String, String)
Displays a message box in front of the specified object and with the specified text and caption.
Parameters
An implementation of IWin32Window that will own the modal dialog box.
The text to display in the message box.
The text to display in the title bar of the message box.
Returns
One of the DialogResult values.
Remarks
You can use the owner parameter to specify a particular object, which implements the IWin32Window interface, that will serve as the dialog box’s top-level window and owner. 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.
By default, the message box displays an OK button.
Applies to
Show(String, String, MessageBoxButtons)
Displays a message box with specified text, caption, and buttons.
Parameters
The text to display in the message box.
The text to display in the title bar of the message box.
One of the MessageBoxButtons values that specifies which buttons to display in the message box.
Returns
One of the DialogResult values.
Exceptions
The buttons parameter specified is not a member of MessageBoxButtons.
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.
Examples
The following code example demonstrates how to display a MessageBox with the options supported by this overload of Show. After verifying that a string variable, ServerName , is empty, the example displays a MessageBox, offering the user the option to cancel the operation. If the Show method’s return value evaluates to Yes, the form that displayed the MessageBox is closed.
Remarks
You can have a maximum of three buttons on the message box.
See also
Applies to
Show(IWin32Window, String)
Displays a message box in front of the specified object and with the specified text.
Parameters
An implementation of IWin32Window that will own the modal dialog box.
The text to display in the message box.
Returns
One of the DialogResult values.
Remarks
You can use the owner parameter to specify a particular object, which implements the IWin32Window interface, that will serve as the dialog box’s top-level window and owner. 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.
By default, the message box displays an OK button. The message box does not contain a caption in the title.
Applies to
Show(String, String)
Displays a message box with specified text and caption.
Parameters
The text to display in the message box.
The text to display in the title bar of the message box.
Returns
One of the DialogResult values.
Remarks
By default, the message box displays an OK button.
Applies to
Show(String, String, MessageBoxButtons, MessageBoxIcon, MessageBoxDefaultButton, MessageBoxOptions)
Displays a message box with the specified text, caption, buttons, icon, default button, and options.
Parameters
The text to display in the message box.
The text to display in the title bar of the message box.
One of the MessageBoxButtons values that specifies which buttons to display in the message box.
One of the MessageBoxIcon values that specifies which icon to display in the message box.
One of the MessageBoxDefaultButton values that specifies the default button for the message box.
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.
Returns
One of the DialogResult values.
Exceptions
buttons is not a member of MessageBoxButtons.
icon is not a member of MessageBoxIcon.
The defaultButton specified is not a member of MessageBoxDefaultButton.
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.
buttons specified an invalid combination of MessageBoxButtons.
Examples
The following code example demonstrates how to display a MessageBox with the options supported by this overload of Show. After verifying that a string variable, ServerName , is empty, the example displays a MessageBox with a question box icon, offering the user the option to cancel the operation. The example uses the RightAlign member of the MessageBoxOptions enumeration to align the text to the right edge of the dialog box. If the Show method’s return value evaluates to Yes, the form that displayed the MessageBox is closed.
Remarks
You can have a maximum of three buttons on the message box.
See also
Applies to
Show(IWin32Window, String, String, MessageBoxButtons, MessageBoxIcon, MessageBoxDefaultButton, MessageBoxOptions, String, HelpNavigator, Object)
Displays a message box with the specified text, caption, buttons, icon, default button, options, and Help button, using the specified Help file, HelpNavigator , and Help topic.
Parameters
An implementation of IWin32Window that will own the modal dialog box.
The text to display in the message box.
The text to display in the title bar of the message box.
One of the MessageBoxButtons values that specifies which buttons to display in the message box.
One of the MessageBoxIcon values that specifies which icon to display in the message box.
One of the MessageBoxDefaultButton values that specifies the default button for the message box.
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.
The path and name of the Help file to display when the user clicks the Help button.
One of the HelpNavigator values.
The numeric ID of the Help topic to display when the user clicks the Help button.
Returns
One of the DialogResult values.
Exceptions
buttons is not a member of MessageBoxButtons.
icon is not a member of MessageBoxIcon.
The defaultButton specified is not a member of MessageBoxDefaultButton.
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.
buttons specified an invalid combination of MessageBoxButtons.
Examples
The following code example demonstrates how to show a message box parented to the main window. The message box displays a Help button. When the user clicks the Help button, the Mspaint.chm Help file is opened and the Help index tab and the topic identified by the ovals keyword are displayed. The example requires that the Mspaint.chm Help file is installed.
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. You can use the owner parameter to specify a particular object, which implements the IWin32Window interface, that will serve as the dialog box’s top-level window and owner.
When the user clicks the Help button, the Help file specified in the helpFilePath parameter is opened and the Help content identified by the navigator parameter is displayed. The form that owns the message box (or the active form) also receives the HelpRequested event.
Compiled help files provide table of contents, index, search, and keyword links in pages. You can use the following values for navigator : TableOfContents, Find, Index, or Topic.
You can use param to provide further refinement of the Topic command. If the value specified in the navigator parameter is TableOfContents, Index, or Find, this value should be null . If the navigator parameter references Topic, this value should reference an object that contains the numeric value of the topic to display.