共用方式為


MessageBoxResult Enumeration

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

Represents a user's response to a message box.

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

Syntax

'Declaration
Public Enumeration MessageBoxResult
public enum MessageBoxResult

Members

Member name Description
Supported by Silverlight for Windows Phone None This value is not currently used.
Supported by Silverlight for Windows Phone OK The user clicked the OK button.
Supported by Silverlight for Windows Phone Cancel The user clicked the Cancel button or pressed ESC.
Supported by Silverlight for Windows Phone Yes This value is not currently used.
Supported by Silverlight for Windows Phone No This value is not currently used.

Remarks

This enumeration is used by the MessageBox.Show method.

Examples

The following code example demonstrates how to use this enumeration.

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.");
}

Version Information

Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

Platforms

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