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
AddHandlerAddressOfAliasAnd
AndAlsoAsBooleanByRef
ByteByValCallCase
CatchCBoolCByteCChar
CDateCDblCDecChar
CIntClass ConstraintClass StatementCLng
CObjConstContinueCSByte
CShortCSngCStrCType
CUIntCULngCUShortDate
DecimalDeclareDefaultDelegate
DimDirectCastDoDouble
EachElseElseIfEnd Statement
End<keyword>EndIfEnumErase
ErrorEventExitFalse
FinallyFor(in For…Next)For Each…NextFriend
FunctionGetGetTypeGetXMLNamespace
GlobalGoSubGoToHandles
IfIf()ImplementsImplements Statements
Imports(.NET Namespace and Type)Imports(XML Namespace)InIn(Generic Modifier)
Inherits IntegerInterfaceIs
IsNotKetLibLike
LongLoopMeMod
ModuleModule StatementMust InheritMust Override
MyBaseMyClassNameOfNamespace
NarrowingNew ConstraintNew OperatorNext
Next (in Resume)NotNothingNotInheritable
NotOverridableObjectOfOn
OperatorOptionOptionalOr
OrElseOut(Generic Modifier)OverloadsOverridable
OverridesParamArrayPartialPrivate
PropertyProtectedPublicRaiseEvent
ReadOnlyReDimREMRemoveHandler
ResumeReturnSByteSelect
SetShadowsSharedShort
SingleStaticStepStop
StringStructure ConstraintStructure StatementSub
SyncLockThenThrowTo
TrueTryTryCastTypeOf..Is
UIntegerULongUShortUsing
VariantWendWhenWhile
WideningWithWithEventsWriteOnly
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
AggregateAnsiAssemblyASync
AutoAwaitBinaryCompare
CustomDistinctEqualsExplicit
FromGroup ByGroup JoinInto
IsFalseIsTrueIteratorJoin
KeyMidOffOrder By
PreserveSkipSkip WhileStrict
TakeTake WhileTextUnicode
UntilWhereYield#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.