Friday, June 5, 2026 Sign InRegister FREE My Account Help
FDN Portal
FDN » ASP & VBScript » VBScript Language Reference

VBScript Language Reference

VBScript Language Reference

VBScript is the default scripting language for ASP and Windows Script Host (WSH). This reference covers the essential language features.

Variables and Constants

Option Explicit  ' Require variable declarations

Dim strName, intAge, blnActive
strName   = "John"
intAge    = 30
blnActive = True

Const MAX_RETRIES = 3
Const APP_NAME    = "Flamenet Portal"

Data Types

VBScript has a single data type: Variant. The variant subtype is determined by the value assigned:

SubtypeDescriptionExample
EmptyUninitialized variableDim x
NullNo valid datax = Null
StringCharacter string"Hello"
Integer-32,768 to 32,76742
Long-2B to 2B100000
BooleanTrue or FalseTrue
DateDate/time value#6/15/2001#
ObjectCOM object referenceSet obj = ...

Control Flow

' If...Then...Else
If intAge >= 18 Then
    WScript.Echo "Adult"
ElseIf intAge >= 13 Then
    WScript.Echo "Teenager"
Else
    WScript.Echo "Child"
End If

' Select Case
Select Case strRole
    Case "admin"
        WScript.Echo "Administrator"
    Case "mod"
        WScript.Echo "Moderator"
    Case Else
        WScript.Echo "Member"
End Select

' For...Next
For i = 1 To 10
    WScript.Echo i
Next

' For Each
Dim arr
arr = Array("apple", "banana", "cherry")
For Each item In arr
    WScript.Echo item
Next

' Do While
Do While Not rs.EOF
    WScript.Echo rs("Name")
    rs.MoveNext
Loop

String Functions

FunctionDescriptionExample
Len(s)String lengthLen("Hello") = 5
Left(s, n)Left n charactersLeft("Hello", 3) = "Hel"
Right(s, n)Right n charactersRight("Hello", 2) = "lo"
Mid(s, start, len)SubstringMid("Hello", 2, 3) = "ell"
InStr(s, find)Position of substringInStr("Hello", "ll") = 3
Replace(s, old, new)Replace textReplace("abc", "b", "x") = "axc"
UCase(s) / LCase(s)Case conversionUCase("hello") = "HELLO"
Trim(s)Remove spacesTrim(" hi ") = "hi"
Split(s, d)Split to arraySplit("a,b,c", ",") = Array
Join(arr, d)Join arrayJoin(arr, ",") = "a,b,c"
« Previous ASP Fundamentals
More in ASP & VBScript
« Back to ASP & VBScript « Back to FDN
FlameNet Weekly: the best of the forum, freshest listings, top Q&A — delivered every Sunday.
13 members · 0 new today · 0 online now · 769 posts in last 24h