Displays a message to the user and optionally prompts for a response.
Namespace:
System.Windows
Assembly:
System.Windows (in System.Windows.dll)
Visual Basic (Declaration)
Public NotInheritable Class MessageBox
Dim instance As MessageBox
public sealed class MessageBox
The MessageBox class provides a static Show method that you can use to display a message in a simple dialog box. The dialog box is modal and provides an OK button.
An overload of the Show method enables you to specify a title bar caption and an optional Cancel button. If you display a Cancel button, you can use the return value of the method to determine the user's response.
The message box may have a slightly different appearance on different platforms. For example, the message box includes an icon when it is displayed on a Macintosh.
The following example code demonstrates how to use this class.
Dim result As MessageBoxResult = _
MessageBox.Show("Would you like to see the simple version?", _
"MessageBox Example", MessageBoxButton.OKCancel)
If (result = MessageBoxResult.OK) Then
MessageBox.Show("No caption, one button.")
End If
MessageBoxResult result =
MessageBox.Show("Would you like to see the simple version?",
"MessageBox Example", MessageBoxButton.OKCancel);
if (result == MessageBoxResult.OK)
{
MessageBox.Show("No caption, one button.");
}
System..::.Object
System.Windows..::.MessageBox
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.
Reference