Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

is there anyway check the data type of a variable? 1

Status
Not open for further replies.

angel0910

Programmer
Jun 26, 2002
17
0
0
SG
Hi,

Is there anyway check the data type of a certain variable?
whether it is int, string or others?

thanxs a million :)
 
To see if its a number you can use IsNumeric to see if its an object you can use IsObject, I am unsure how to check if its a string..
 
You can use the vbscript function "vartype(variable)" to determine the datatype of the variable.
It will return an integer value for each type. Following are the returned 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
 
wow!
thanxs for ur help lpatnaik and snowboardr :)
u guys are greatz :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top