Return the type of the specified variant variable.
[ enType = ] VarType ( pv )
The VarType procedure syntax has the following parts:
Name |
Type |
Description |
enType |
enumAVarType |
Type of data in the specified variant type. |
pv |
Val Variant |
A variant |
enumAVarType can be one of the following values for a variant created by ATEasy:
Name |
Value |
ATEasy equivalent |
vtEmpty |
0 |
Un-initialized variable |
vtNull |
1 |
SQL-style Null |
vtI2 |
2 |
Short |
vtI4 |
3 |
Long |
vtR4 |
4 |
Float |
vtR8 |
5 |
Double |
vtCy |
6 |
Currency |
vtDate |
7 |
DateTime |
vtBStr |
8 |
BString |
vtDispatch |
9 |
Object |
vtError |
10 |
Error Code |
vtBool |
11 |
Bool |
vtVariant |
12 |
Variant |
vtUnknown |
13 |
Object of known type, for example, ACheckBox |
vtDecimal |
14 |
Decimal |
vtI1 |
16 |
Char |
vtUI1 |
17 |
Byte |
vtUI2 |
18 |
Word |
vtUI4 |
19 |
DWord |
vtI8 |
20 |
DLong (v5.0) |
vtUI8 |
21 |
DDWord (v5.0) |
vtArray |
0x2000 |
Array, ORed with the data type (i.e. vtR8 or vtArray) (v8) |
vtByRef |
0x4000 |
Var Parameter (pointer) ORed with the data type (i.e. vBStr or vtByRef) (v8) |
vtTypeMask |
0xFFF |
Make to get the data type from the variant type (v8) |
Returns the subtype of data contained in the given Variant. vtArray and vtByRef are masked out from the return value, only basic data type are returned.
v=300 ! v is a Variant type
print VarType(v) ! prints 3 - vtI4
v="String"
print VarType(v) ! prints 8 - vtBStr
v=7.5
print VarType(v) ! prints 5 - vtR8
v=cur ! cur is a Currency type
print VarType(v) ! prints 6 - vtCy