Home > Articles > Programming > Windows Programming

  • Print
  • + Share This
  • 💬 Discuss
This chapter is from the book

This chapter is from the book

Visual Basic 2010 Reserved Keywords

When writing code, you often define types or declare variables. Types and variables are recognizable via identifiers. An identifier is essentially the name of a type or of a variable and not necessarily a word that makes sense, although it is a good practice to assign human readable identifiers. For example, an identifier such as DoSomething is much better than DoSmt. For this, there are some words in the Visual Basic lexical grammar that you cannot use as identifiers for your variables because they are reserved for the language.

Table 3.1 shows a list of the Visual Basic 2010 reserved words.

Table 3.1. Visual Basic 2010 Reserved Keywords

AddHandler

AddressOf

Alias

And

AndAlso

As

Boolean

ByRef

Byte

ByVal

Call

Case

Catch

CBool

CByte

CChar

CDate

CDbl

CDec

Char

CInt

Class

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

EndIf

Enum

Erase

Error

Event

Exit

False

Finally

For

Friend

Function

Get

GetType

GetXmlNamespace

Global

GoSub

GoTo

Handles

If

Implements

Imports

In

Inherits

Integer

Interface

Is

IsNot

Let

Lib

Like

Long

Loop

Me

Mod

Module

MustInherit

MustOverride

MyBase

MyClass

Namespace

Narrowing

New

Next

Not

Nothing

NotInheritable

NotOverridable

Object

Of

On

Operator

Option

Optional

Or

OrElse

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

Sub

SyncLock

Then

Throw

To

True

Try

TryCast

TypeOf

UInteger

ULong

UShort

Using

Variant

Wend

When

While

Widening

With

WithEvents

WriteOnly

Xor

Although the code editor is powerful enough to advise when you are attempting to use a reserved keyword as an identifier, having a reference is practical.

  • + Share This
  • 🔖 Save To Your Account

Discussions

comments powered by Disqus