Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

Intrinsic Constants and Enumerations

Visual Basic .NET provides a number of intrinsic constants and enumerations to facilitate your programming.

Constants store values that remain constant throughout the execution of an application. They are meaningful names that take the place of a number or string and make code more readable. Enumerations offer an easy way to work with sets of related constants. An enumeration, or Enum, is a symbolic name for a set of values.

In the following enumeration, SchoolDays, the constant NotValid is assigned the value of -1, and the constant Sunday is assigned the value of 0. Because it is the first constant, Saturday is also initialized to a value of 0. The value of Monday is 1 (one more than the value of Sunday, the immediately preceding value); the value of Tuesday is 2 (one more than Monday, the immediately preceding value).

Public Enum SchoolDays
   Sunday = 0
   NotValid = -1
End Enum

You can create your own constants and enumerations, as discussed in User-Defined Constants, or you can use the intrinsic constants and enumerations Visual Basic .NET provides, which are listed in the Object Browser. The following table lists the intrinsic enumerations available in Visual Basic .NET.

Enumeration Used with
AppWinStyle Shell commands
CallType CallByName function
CompareMethod Comparison functions
DateFormat DateValue function
FileAttribute Dir, GetAttr and SetAttr functions
FirstDayOfWeek Date related functions
FirstWeekOfYear Date related functions
MsgBoxResult MsgBox function
MsgBoxStyle MsgBox function
Tristate Number-formatting functions
VbStrConv StrConv function

See Also

Constants and Enumerations | Constants Overview | Declaring Constants | Constant and Literal Data Types | Enumerations Overview | User-Defined Constants | Enum Statement | Object Browser

© 2015 Microsoft