Visual Basic 4.0 Keyword summary by Topic
This document gives you an overview of the different common statements in VB 4.0, their use and context.
Author: Paul Hayes

Array

Verify an array. IsArray
Create an array. Array
Change default lower limit. Option Base
Declare and initialize an array. Dim, Private, Public, ReDim, Static
Find the limits of an array. LBound, UBound
Reinitialize an array. Erase, ReDim

Compiler Directive

Define conpiler constant. #Const
Compile selected blocks of code. #If...Then...#Else

Control Flow

Branch. GoSub...Return, GoTo, On Error, On...GoSub, On...GoTo
Exit or pause the program. DoEvents, End, Exit, Stop Loop, Do...Loop , For...Next, For Each...Next, While...Wend, With
Make decisions. Choose, If...Then...Else, Select Case, Switch
Procedures. Call, Function...End Function, Property Get...End Property, Property Let...End Property, Property Set...End Property, Sub...End Sub

Conversion

ANSI value to string. Chr
Convert to lowercase or uppercase. Format, LCase, UCase
Date to serial number. DateSerial, DateValue
Decimal number to other bases. Hex, Oct
Number to string. Format, Str
One data type to another. CBool, CByte, CCur, CDate, CDbl, CInt, CLng, CSng, CStr, CVar, CVErr, Fix, Int
Serial number to date. Date, Month, Weekday, Year
Serial number to time. Hour
String to ASCII value. Asc
String to number. Val
Time to serial number. TimeSerial, TimeValue

Data types

Convert between data types. CBool, CByte, CCur, CDate, CDbl, CInt, CLng, CSng, CStr, CVar, CVErr, Fix, Int
Setting intrinsic data types. Boolean, Byte, Currency, Date, Double, Integer, Long, Object, Single, String, Variant (default)
Verifying data types. IsArray, IsDate, IsEmpty, IsError, IsMissing, IsNull, IsNumeric, IsObject

Dates & Times

Get the current date or time. Date, Now, Time
Return a date. DateSerial, DateValue
Return a time. TimeSerial, TimeValue
Set the date or time. Date, Time
Time a process. Timer
Perform date calculations. DateAdd, DateDiff, DatePart

Directories & Files

Change directory or folder. ChDir
Change the drive. ChDrive
Copy a file. FileCopy
Make directory or folder. MkDir
Remove directory or folder. RmDir
Return current path. CurDir
Return file, directory, label attributes. GetAttr
Return file name or volume label. Dir
Return file date/time stamp. FileDateTime
Return file length. FileLen
Rename a file, directory, or folder. Name
Set attribute information for a file. SetAttr

Errors

Get error messages. Error
Provide error information. Err
Generate run-time errors. Clear, Error, Raise
Trap errors during run time. On Error, Resume
Type verification. IsError
Return Error variant. CVErr

Financial

Get error messages. Error
Provide error information. Err
Generate run-time errors. Clear, Error, Raise
Trap errors during run time. On Error, Resume
Type verification. IsError
Return Error variant. CVErr

Input / Output

Access or create a file. Open
Close files. Close, Reset
Control output appearance. Format, Print, Print #, Spc,Tab, Width #
Copy a file. FileCopy
Get information about a file. EOF, FileAttr, FileDateTime, FileLen, FreeFile, GetAttr, Loc, LOF, Seek
Manage files. Dir, Kill, Lock, Unlock, Name
Read from a file. Get, Input, Input #, Line Input #
Return length of a file. FileLen
Set or get file attributes. FileAttr, GetAttr, SetAttr
Set read-write position in a file. Seek
Write to a file. Print #, Put, Write #

Math

Derive trigonometric functions. Atn, Cos, Sin, Tan
General calculations. Exp, Log, Sqr
Generate random numbers. Randomize, Rnd
Get absolute value. Abs
Get the sign of an expression. Sgn
Perform numeric conversions. Fix, Int

Misc

Process pending events. DoEvents
Run other programs. AppActivate, Shell
Send keystrokes to an application. SendKeys
Sound a beep from computer. Beep
System. Command, Environ
OLE Automation. CreateObject, GetObject

Operators

Arithmetic. ^, -, *, /, \, Mod, +, &
Comparison. =, <>, <,>, <=,>=, Like, Is
Logical operations. Not, And, Or, Xor, Eqv, Imp

String manipulation

Compare two strings. StrComp
Convert to lowercase or uppercase. Format, LCase, UCase
Create string of repeating character. Space, String
Find length of a string. Len
Format a string. Format
Justify a string. LSet, RSet
Manipulate strings. Instr, Left, LTrim, Mid, Right, RTrim, Trim
Set string comparison rules. Option Compare
Work with ASCII and ANSI values. Asc, Chr
Convert strings. StrConv
Color and shapes. Circle, Line, PSet, QBColor, RGB

Variables and Constants

Assign value. Let
Declare variables or constants. Const, Dim, Private, Public, New, Static
Declare module as private. Option Private Module
Get information about a variant. IsArray, IsDate, IsEmpty, IsError, IsMissing, IsNull, IsNumeric, IsObject, TypeName, VarType
Require explicit variable declarations. Option Explicit
Set default data type. Deftype
Refer to current object Me