Search Search

#1 worldwide
FREE Coding Lessons

since 1996
   THE BEST WAY to learn ASP & Asp.net!
Advertise Here!
click for details
Credits Host:
DiscountASP.net
Server Admin:
The "Team"
Contact Info.
Charles M. Carroll

my Blog
[prev. Lesson]  Browscap: Intricate Details
     [next Lesson]  Listserver for Browser Problems

Determine Data Types by Charles Carroll

VBScript, unlike many languages, does not require or allow you to specify data types. It is possible to examine a variables data type.

The TYPENAME function allows you to determine what type of data a variable is and the types supported includes: Boolean, Byte, Currency, Date, Decimal, Double, Empty, Error, Integer, Long, Nothing, Null, Object*, Single, String and Unknown.

* TYPENAME also returns specific object types like recordset, command, etc. It only returns Object when confronted with a generic object.

VARTYPE returns a number corresponding to the type of value stored in a variable.

The VarType function returns the following values:

Constant Value Description
vbEmpty    0 Empty (uninitialized)
vbNull    1 Null (no valid data)
vbInteger    2 Integer
vbLong    3 Long integer
vbSingle    4 Single-precision floating-point number
vbDouble    5 Double-precision floating-point number
vbCurrency    6 Currency
vbDate    7 Date
vbString    8 String
vbObject    9 Automation object
vbError   10 Error
vbBoolean   11 Boolean
vbVariant   12 Variant (used only with arrays of Variants)
vbDataObject   13 A data-access object
vbByte   17 Byte
vbArray 8192 Array
There are many worthy charities!!. But perhaps help starving children in Africa or South America AND help Charles too. a $5 tip buys him lunch at McDonalds, a $20 tip buys his kid Hitoshi a new computer game, a $39 tip buys his daughter Michiko a few nice outfits. See our donor list.