Udostępnij za pośrednictwem


MessageBox.Show Method (Window, String)

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Displays a message box that contains the specified text and an OK button that is modal to the window specified by the owner parameter.

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

Syntax

'Declaration
Public Shared Function Show ( _
    owner As Window, _
    messageBoxText As String _
) As MessageBoxResult
public static MessageBoxResult Show(
    Window owner,
    string messageBoxText
)

Parameters

  • owner
    Type: System.Windows.Window
    A window reference that represents the top-level window that will own the modal dialog box.

Return Value

Type: System.Windows.MessageBoxResult
MessageBoxResult.OK in all cases.

Exceptions

Exception Condition
ArgumentNullException

messageBoxText is nulla null reference (Nothing in Visual Basic).

-or-

owner is nulla null reference (Nothing in Visual Basic).

Remarks

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.

Version Information

Silverlight

Supported in: 5

Platforms

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