MessageBoxResult Enum
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Specifies which message box button that a user clicks. MessageBoxResult is returned by the Show method.
public enum class MessageBoxResult
public enum MessageBoxResult
type MessageBoxResult =
Public Enum MessageBoxResult
- Inheritance
Name | Value | Description |
---|---|---|
None | 0 | The message box returns no result. |
OK | 1 | The result value of the message box is OK. |
Cancel | 2 | The result value of the message box is Cancel. |
Yes | 6 | The result value of the message box is Yes. |
No | 7 | The result value of the message box is No. |
For more information, see MessageBox Sample.
Show returns a MessageBoxResult value that specifies which button on a message box a user clicked. MessageBoxButton specifies which buttons are displayed on a message box.
The result value that is returned from a message box depends on what buttons the message box has and how a user closes a message box:
On a message box that has an OK button, OK is returned if a user clicks the OK button, clicks the Close button in the title bar, or presses the ESC key.
On a message box that has an OK button and a Cancel button, OK is returned if a user clicks the OK button. If a user clicks the Cancel button or the Close button in the title bar, Cancel is returned.
On a message box that has a Yes button and a No button, the Close button in the title bar is disabled. Consequently, Yes is returned if a user clicks the Yes button, and No is returned if a user clicks the No button.
On a message box that has a Yes button, a No button, and a Cancel button, Yes is returned if the Yes button is clicked and No is returned if the No button is clicked. If a user clicks the Cancel button or the Close button in the title bar, Cancel is returned.
Product | Versions |
---|---|
.NET Framework | 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
Windows Desktop | 3.0, 3.1, 5, 6, 7, 8, 9 |
.NET feedback
.NET is an open source project. Select a link to provide feedback: