
Visual Basic is full of enumerated constants (types) that make programming easier; the meaning of MsgBox value 4 is obscure but the meaning of the value vbYesNo is obvious. Summing up all possible types, states, roles or whatever entities you're dealing with will help you ascertain that you don't forget some cases, causing bugs in the program. By specifying your own enumerated constants for values used within your own organization you make your own code more reliable and easier to maintain.
By default, enumerated constants hold a series of consecutive longs starting from zero. This example assigns values 0 to 3 to four security levels:
The security routines in the rest of the application can now refer to sleAdmin and the other constants instead of their numeric values. The three-letter lower case prefix helps you recognize the constant as part of this enumerated set when you see it in code.
Working with enumerated constants is encouraged by the Select Case from Enum Builder.
You can add a constant to the enumerated type without having to move to the location where it is declared using Add Constant To Enum
Start this dialog from using Alt-CCE (Code-vb - Constant - new Enum)
1. Without starting point, as above example. First value is 0
2. With starting point, each entry has integer value one higher then the previous item
3. Each a separate constant