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 Saturday Sunday = 0 Monday Tuesday Wednesday Thursday Friday 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.
|FileAttribute||Dir, GetAttr and SetAttr functions|
|FirstDayOfWeek||Date related functions|
|FirstWeekOfYear||Date related functions|