Export (0) Print
Expand All
Expand Minimize
This topic has not yet been rated - Rate this topic

MessageBoxButton Enumeration

Specifies the buttons that are displayed on a message box. Used as an argument of the Show method.

Namespace:  System.Windows
Assembly:  PresentationFramework (in PresentationFramework.dll)
public enum MessageBoxButton
<object property="enumerationMemberName" .../>
Member nameDescription
OKThe message box displays an OK button.
OKCancelThe message box displays OK and Cancel buttons.
YesNoCancelThe message box displays Yes, No, and Cancel buttons.
YesNoThe message box displays Yes and No buttons.

By default, the Show method of the MessageBox type displays a message box that has an OK button. You can use overloads of the Show method that accept a MessageBoxButton argument in order to specify different combinations of buttons, which include OK, OK/Cancel, Yes/No, and Yes/No/Cancel.

If you specify YesNo, you disable the Close button in the message box title bar. However, the Close button is enabled for all other options. When a user clicks the Close button or presses the ESC key, a message box returns a message box result value of Cancel. However, if a message box displays only an OK button, clicking the Close button or pressing the ESC key causes a message box to return a message box result value of OK.

The value of the button that a user clicks is returned by Show and is one of the values of the MessageBoxResult enumeration.

For more information, see MessageBox Sample.

.NET Framework

Supported in: 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.