The Visual Basic programming language is made up of a large number of keywords (also referred to as reserved words) that have very specific meanings. An example of a reserved word is Dim, which is used to declare variables and arrays. Because it is a reserved word, you can only use the Dim keyword in your Visual Basic applications when you follow its syntax rules. In other words, you cannot use Dim as a variable name or as a name for any other programming construction (constants, arrays, structures, procedures, and so on).
A reserved word is one that Visual Basic sets aside for a specific purpose. You may only use reserved words in your Visual Basic applications If you follow the rules that govern their usage.
Table 5.4 provides a listing of Visual Basic reserved words for your review.
| AddHandler | AddressOf | Alias | And |
|---|---|---|---|
| AndAlso | Ansi | As | Assembly |
| Auto | Boolean | ByRef | Byte |
| ByVal | Call | Case | Catch |
| Cbool | Cbyte | Cchar | Cdate |
| Cdec | CDbl | Char | Cint |
| Class | CLng | Cobj | Const |
| Cshort | CSng | CStr | Ctype |
| Date | Decimal | Declare | Default |
| Delegate | Dim | DirectCast | Do |
| Double | Each | Else | Elself |
| End | EndIf | Enum | Erase |
| Error | Event | Exit | False |
| Finally | For | Friend | Function |
| Get | GetType | Global | GoSub |
| GoTo | Handles | If | Implements |
| Imports | In | Inherits | Integer |
| Interface | Is | Let | Lib |
| Like | Long | Loop | Me |
| Mod | Module | Mustlnherit | MustOverride |
| MyBase | MyClass | Namespace | New |
| Next | Not | Nothing | Notlnheritable |
| NotOverridable | Object | On | Option |
| Optional | Or | OrElse | Overloads |
| Overridable | Overrides | ParamArray | Preserve |
| Private | Property | Protected | Public |
| RaiseEvent | ReadOnly | ReDim | REM |
| RemoveHandler | Resume | Return | Select |
| Set | Shadows | Shared | Short |
| Single | Static | Step | Stop |
| String | Structure | Sub | SyncLock |
| Then | Throw | To | True |
| Try | TryCast | TypeOf | Unicode |
| Until | Variant | Wend | When |
| While | With | WithEvents | WriteOnly |
| Xor | #Const | #ExternalSource | #If…Then…#Else |
| #Region | - | & | &= |
| * | *= | / | /= |
| \ | \= | ^ | ^= |
| + | += | = | -= |