Keywords (Visual Basic)

 

Updated: July 20, 2015

For the latest documentation on Visual Studio 2017 RC, see Visual Studio 2017 RC Documentation.

The following tables list all Visual Basic language keywords.

The following keywords are reserved, which means that you cannot use them as names for programming elements such as variables or procedures. You can bypass this restriction by enclosing the name in brackets ([``]). For more information, see "Escaped Names" in Declared Element Names.

System_CAPS_ICON_note.jpg Note

We do not recommend that you use escaped names, because it can make your code hard to read, and it can lead to subtle errors that can be difficult to find.

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 Statement
Imports (.NET Namespace and Type)Imports (XML Namespace)InIn (Generic Modifier)
InheritsIntegerInterfaceIs
IsNotLetLibLike
LongLoopMeMod
ModuleModule StatementMustInheritMustOverride
MyBaseMyClassNamespaceNarrowing
New ConstraintNew OperatorNextNext (in Resume)
NotNothingNotInheritableNotOverridable
ObjectOfOnOperator
OptionOptionalOrOrElse
Out (Generic Modifier)OverloadsOverridableOverrides
ParamArrayPartialPrivateProperty
ProtectedPublicRaiseEventReadOnly
ReDimREMRemoveHandlerResume
ReturnSByteSelectSet
ShadowsSharedShortSingle
StaticStepStopString
Structure ConstraintStructure StatementSubSyncLock
ThenThrowToTrue
TryTryCastTypeOf…IsUInteger
ULongUShortUsingVariant
WendWhenWhileWidening
WithWithEventsWriteOnlyXor
#Const#Else#ElseIf#End
#If=&&=
**=//=
\\=^^=
++=--=
>> Operator>>= Operator<<<<=
System_CAPS_ICON_note.jpg Note

EndIf, GoSub, Variant, and Wend are retained as reserved keywords, although they are no longer used in Visual Basic. The meaning of the Let keyword has changed. Let is now used in LINQ queries. For more information, see Let Clause.

The following keywords are not reserved, which means you can use them as names for your programming elements. However, doing this is not recommended, because it can make your code hard to read and can lead to subtle errors that can be difficult to find.

AggregateAnsiAssemblyAsync
AutoAwaitBinaryCompare
CustomDistinctEqualsExplicit
FromGroup ByGroup JoinInto
IsFalseIsTrueIteratorJoin
KeyMidOffOrder By
PreserveSkipSkip WhileStrict
TakeTake WhileTextUnicode
UntilWhereYield#ExternalSource
#Region
TitleDescription
Arrays SummaryLists language elements that are used to create, define, and use arrays.
Collection Object SummaryLists language elements that are used for collections.
Compiler Directive Summary (Visual Basic)Lists directives that control compiler behavior.
Control Flow SummaryLists statements that are used for looping and controlling procedure flow.
Conversion SummaryLists functions that are used to convert numbers, dates, times, and strings.
Data Types SummaryLists data types. Also lists functions that are used to convert between data types and verify data types.
Dates and Times SummaryLists language elements that are used for dates and times.
Declarations and Constants SummaryLists statements that are used to declare variables, constants, classes, modules, and other programming elements. Also lists language elements that are used to obtain object information, handle events, and implement inheritance.
Directories and Files SummaryLists functions that are used to control the file system and to process files.
Errors SummaryLists language elements that are used to catch and return run-time error values.
Financial SummaryLists functions that are used to perform financial calculations.
Input and Output SummaryLists functions that are used to read from and write to files, manage files, and print output.
Information and Interaction SummaryLists functions that are used to run other programs, obtain command-line arguments, manipulate COM objects, retrieve color information, and use control dialog boxes.
Math SummaryLists functions that are used to perform trigonometric and other mathematical calculations.
My ReferenceLists the objects contained in My, a feature that provides access to frequently used methods, properties, and events of the computer on which the application is running, the current application, the application's resources, the application's settings, and so on.
Operators SummaryLists assignment and comparison expressions and other operators.
Registry SummaryLists functions that are used to read, save, and delete program settings.
String Manipulation SummaryLists functions that are used to manipulate strings.

Visual Basic Runtime Library Members

Show: