Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
MsgBoxStyle Enumeration

MsgBoxStyle Enumeration

Indicates which buttons to display when calling the MsgBox function.

This enumeration has a FlagsAttribute attribute that allows a bitwise combination of its member values.

Namespace:  Microsoft.VisualBasic
Assembly:  Microsoft.VisualBasic (in Microsoft.VisualBasic.dll)

[FlagsAttribute]
public enum MsgBoxStyle

Member nameDescription
OkOnlyOK button only (default). This member is equivalent to the Visual Basic constant vbOKOnly.
OkCancelOK and Cancel buttons. This member is equivalent to the Visual Basic constant vbOKCancel.
AbortRetryIgnoreAbort, Retry, and Ignore buttons. This member is equivalent to the Visual Basic constant vbAbortRetryIgnore.
YesNoCancelYes, No, and Cancel buttons. This member is equivalent to the Visual Basic constant vbYesNoCancel.
YesNoYes and No buttons. This member is equivalent to the Visual Basic constant vbYesNo.
RetryCancelRetry and Cancel buttons. This member is equivalent to the Visual Basic constant vbRetryCancel.
CriticalCritical message. This member is equivalent to the Visual Basic constant vbCritical.
QuestionWarning query. This member is equivalent to the Visual Basic constant vbQuestion.
ExclamationWarning message. This member is equivalent to the Visual Basic constant vbExclamation.
InformationInformation message. This member is equivalent to the Visual Basic constant vbInformation.
DefaultButton1First button is default. This member is equivalent to the Visual Basic constant vbDefaultButton1.
DefaultButton2Second button is default. This member is equivalent to the Visual Basic constant vbDefaultButton2.
DefaultButton3Third button is default. This member is equivalent to the Visual Basic constant vbDefaultButton3.
ApplicationModalApplication modal message box. This member is equivalent to the Visual Basic constant vbApplicationModal.
SystemModalSystem modal message box. This member is equivalent to the Visual Basic constant vbSystemModal.
MsgBoxHelpHelp text. This member is equivalent to the Visual Basic constant vbMsgBoxHelp.
MsgBoxRightRight-aligned text. This member is equivalent to the Visual Basic constant vbMsgBoxRight.
MsgBoxRtlReadingRight-to-left reading text (Hebrew and Arabic systems). This member is equivalent to the Visual Basic constant vbMsgBoxRtlReading.
MsgBoxSetForegroundForeground message box window. This member is equivalent to the Visual Basic constant vbMsgBoxSetForeground.

When you call the MsgBox function, you can use the MsgBoxStyle enumeration in your code in place of the actual values. The Buttons argument takes the MsgBoxStyle enumeration members.

.NET Framework

Supported in: 4, 3.5, 3.0, 2.0, 1.1, 1.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, 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.

Community Additions

ADD
Show:
© 2015 Microsoft