MessageBox.Show Method (Window, String)

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)


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


  • 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.


Exception Condition

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


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


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


Supported in: 5


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