VB.NET Keywords
VB.NET Keywords: Keyword is a reserved word that has a special meaning to the compiler, whose significance cannot be changed. Keywords are not able to be used as a reference (identifier) in VB.NET applications such as class name, variable, function, module, etc.
This part will let you know about VB.NET Keywords. Programs gather components. This language has lots of Keywords. We are reading the meaning of these keywords. After that we combine them into high-quality buildings and systems. Some keywords (like For and while) are a building map. And some (Class, Dim and Sub) are part of the announcements. VB.NET keywords are divided into two different categories - one reserved for keywords and the other for unsaved keywords. All programming languages ??have the pre-defined words reserved for use. The reserved words are known as Keywords.
Reserved Keywords
The keywords given below in the table are termed as Reserved Keywords. The reserved keywords will not allow us to use them as names for programming elements such as variables, class, etc. You can exceed this limit by entering a name in brackets ([]). If required more information then, search the term “Escaped Names” in the Declared Elements Names.
One should try to avoid the use of Escaped Names because using this can construct your code making it difficult to read. Due to this, there can be issue of hidden errors which are very hard to find.
In programming, Keywords have a different state. The keywords in Visual Basic .NET are termed as reserved, thus these keywords are unable to be used as tokens for tasks like naming of Variables and subroutines.
Keywords in Visual Basic .NET
RESERVED KEYWORDS | |||
AddHandler | AddressOf | Alias | And |
AndAlso | As | Boolean | ByRef |
Byte | ByVal | Call | Case |
Catch | CBool | CByte | CChar |
CDate | CDbl | CDec | Char |
CInt | Class Constraint | Class Statement | CLng |
CObj | Const | Continue | CSByte |
CShort | CSng | CStr | CType |
CUInt | CULng | CUShort | Date |
Decimal | Declare | Default | Delegate |
Dim | DirectCast | Do | Double |
Each | Else | ElseIf | End Statement |
End<keyword> | EndIf | Enum | Erase |
Error | Event | Exit | False |
Finally | For(in For…Next) | For Each…Next | Friend |
Function | Get | GetType | GetXMLNamespace |
Global | GoSub | GoTo | Handles |
If | If() | Implements | Implements Statements |
Imports(.NET Namespace and Type) | Imports(XML Namespace) | In | In(Generic Modifier) |
Inherits | Integer | Interface | Is |
IsNot | Ket | Lib | Like |
Long | Loop | Me | Mod |
Module | Module Statement | Must Inherit | Must Override |
MyBase | MyClass | NameOf | Namespace |
Narrowing | New Constraint | New Operator | Next |
Next (in Resume) | Not | Nothing | NotInheritable |
NotOverridable | Object | Of | On |
Operator | Option | Optional | Or |
OrElse | Out(Generic Modifier) | Overloads | Overridable |
Overrides | ParamArray | Partial | Private |
Property | Protected | Public | RaiseEvent |
ReadOnly | ReDim | REM | RemoveHandler |
Resume | Return | SByte | Select |
Set | Shadows | Shared | Short |
Single | Static | Step | Stop |
String | Structure Constraint | Structure Statement | Sub |
SyncLock | Then | Throw | To |
True | Try | TryCast | TypeOf..Is |
UInteger | ULong | UShort | Using |
Variant | Wend | When | While |
Widening | With | WithEvents | WriteOnly |
Xor | #Const | #Else | #ElseIf |
#End | #If | = | & |
&= | * | *= | / |
/= | \ | \= | ^ |
^= | + | += | - |
-= | >>Operator | >>=Operator | << |
<<= |
Unreserved Keywords
These keywords are unreserved; this is why one can use them as names for the program items. But this way is not suggested because if doing this could make your code difficult to study which could lead to the errors that are hidden and difficult to detect.
UNRESERVED KEYWORDS | |||
Aggregate | Ansi | Assembly | ASync |
Auto | Await | Binary | Compare |
Custom | Distinct | Equals | Explicit |
From | Group By | Group Join | Into |
IsFalse | IsTrue | Iterator | Join |
Key | Mid | Off | Order By |
Preserve | Skip | Skip While | Strict |
Take | Take While | Text | Unicode |
Until | Where | Yield | #ExternalSource |
#Region |
Identifiers
The Identifiers are the names provided to various system items like variations, lists, functions and structures etc. In simple terms, identifiers are used to name items or to identify the items of the program which we use in the program uniquely.
In VB.NET, we must follow the rules for writing the identifier as given below:
- The cursor can use words, digits and accents.
- The cursor starts with the alphabet or the underscores (_).
- Identifier cannot start with digits (0-9).
- Keyword cannot be used as an identifier.
- References cannot contain special punctuation marks or characters such as @,!,&, ^, # etc.