JavaScript Editor JavaScript Editor     JavaScript Debugger

Previous Section Next Section

Main Page

The Visual Basic Keywords

As with all programming languages, Visual Basic is built using keywords. You'll find these keywords in Table 2.1. These keywords are reserved for use by Visual Basic, and you use them to build your programs.

Table 2.1: The Visual Basic keywords.

#Const

#IfThen#Else

&

&=

*

*=

/

/=

\

\=

^^=

+

+=

=

-=

Add

AddHandler

AddressOf

Alias

And

AndAlso

Ansi

AppActivate

As

Asc

AscW

Assembly

Auto

Beep

Boolean

ByRef

Byte

ByVal

Call

CallByName

Case

Catch

CBool

CByte

CChar

CDate

CDbl

CDec

Char

ChDir

ChDrive

Choose

Chr

CInt

Class

Clear

CLng

Close

CObj

Command

Const

Count

CreateObject

CShort

CSng

CStr

CType

CurDir

Date

DateAdd

DateDiff

DatePart

DateSerial

DateString

DateValue

Day

DDB

Decimal

Declare

Default

Delegate

DeleteSetting

Description

Dim

Dir

Do

Double

Each

Else

ElseIf

End

Enum

Environ

EOF

Erase

Erl

Err

Error

ErrorToString

Event

Exit

ExternalSource

False

FileAttr

FileCopy

FileDateTime

FileGet

FileLen

FileOpen

FilePut

FileWidth

Filter

Finally

Fix

For

FormatCurrency

FormatDateTime

FormatNumber

FormatPercent

FreeFile

Friend

Function

FV

Get

GetAllSettings

GetAttr

GetChar

GetException

GetObject

GetSetting

GetType

GoTo

Handles

HelpContext

HelpFile

Hex

Hour

If

IIf

Implements

Imports

In

Inherits

Input

InputBox

InputString

InStr

InStrRev

Int

Integer

Interface

IPmt

IRR

Is

IsArray

IsDate

IsDBNull

IsError

IsNothing

IsNumeric

IsReference

Item

Join

Kill

LastDllError

LBound

LCase

Left

Len

Let

Lib

Like

LineInput

Loc

Lock

LOF

Long

Loop

LSet

LTrim

Me

Mid

Minute

MIRR

MkDir

Mod

Module

Month

MonthName

MsgBox

MustInherit

MustOverride

MyBase

MyClass

Namespace

New

Next

Not

Nothing

NotInheritable

NotOverridable

Now

NPer

NPV

Number

Object

Oct

On

Option

Optional

Or

OrElse

Overloads

Overridable

Overrides

ParamArray

Partition

Pmt

PPmt

Preserve

Print

PrintLine

Private

Property

Protected

Public

PV

QBColor

Raise

RaiseEvent

Randomize

Rate

ReadOnly

ReDim

Region

Rem

Remove

RemoveHandler

Rename

Replace

Reset

Resume

Return

RGB

RmDir

Rnd

RSet

RTrim

SaveSetting

Seek

ScriptEngine

ScriptEngine

ScriptEngine

ScriptEngine

Second

BuildVersion

MajorVersion

MinorVersion

Select

Set

SetAttr

Shadows

Shared

Shell

Short

Single

SLN

Source

Space

Spc

Split

Static

Step

Stop

Str

StrComp

StrConv

StrDup

String

StrReverse

Structure

Sub

Switch

SYD

SyncLock

SystemTypeName

Tab

Then

Throw

TimeOfDay

Timer

TimeSerial

TimeString

TimeValue

To

Today

Trim

True

Try

TypeName

TypeOf

UBound

UCase

Unicode

Unlock

Until

Val

Variant

VarType

VbTypeName

WeekDay

WeekDayName

When

While

With

WithEvents

Write

WriteLine

WriteOnly

Xor

Year

    
Tip 

Although the keywords in Table 2.1 are reserved for use by VB .NET, it turns out you can use them for your own use if you surround them with brackets, [ and ]. For example, if you wanted to name a text string Error, you could actually use the term [Error] as a variable.

There are also quite a few keywords and phrases in VB6 that are now obsolete, which you can see in Table 2.2.

Table 2.2: Visual Basic 6 keywords and phrases now obsolete.

As Any

Atn

Calendar

Circle

Currency

Date$

Debug.Assert

Debug.Print

Deftype

DoEvents

Empty

Eqv

GoSub

Imp

Initialize

Instancing

IsEmpty

IsMissing

IsNull

IsObject

Let

Line

LSet

MsgBox

Now

Null

OnGoSub

OnGoTo

Option Base

Option

Private

Module

Property Get, Property Let, and Property Set

PSet

Rnd

Round

RSet

Scale

Set

Sgn

Sqr

Terminate

Time

Time$

Type

Varian

VarType

Wend

In general, Visual Basic programs are made up line by line of code, and these lines of code are called statements.

Previous Section Next Section




JavaScript Editor Free JavaScript Editor     JavaScript Editor