Export (0) Print
Expand All

MessageBox.Show Method (Window, String, String, MessageBoxButton)

Displays a message box that is modal to the window specified by the owner parameter.

Namespace:  System.Windows
Assembly:  System.Windows (in System.Windows.dll)

public static MessageBoxResult Show(
	Window owner,
	string messageBoxText,
	string caption,
	MessageBoxButton button
)

Parameters

owner
Type: System.Windows.Window
A window reference that represents the top-level window that will own the modal dialog box.
messageBoxText
Type: System.String
The message to display.
caption
Type: System.String
The title of the message box.
button
Type: System.Windows.MessageBoxButton
A value that indicates the button or buttons to display.

Return Value

Type: System.Windows.MessageBoxResult
A MessageBoxResult value that indicates the user's response to the message.

ExceptionCondition
ArgumentNullException

messageBoxText is null.

-or-

owner is null.

-or-

caption is null.

ArgumentException

button is not a valid MessageBoxButton value.

This method is only applicable to trusted out-of-browser applications. If it is called in an application that does not have elevated permissions and is out-of-browser, the message box will be modal to the web-browser main window.

Silverlight

Supported in: 5

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

Community Additions

ADD
Show:
© 2014 Microsoft