VarType: Difference between revisions
Jump to navigation
Jump to search
→Description: add additional vartypes |
|||
Line 12: | Line 12: | ||
|- | |- | ||
! Constant !! Value !! Description | ! Constant !! Value !! Description | ||
|- | |||
| vbEmpty || 0 || Empty | |||
|- | |||
| vbNull || 1 || Null | |||
|- | |- | ||
| vbInteger || 2 || Integer | | vbInteger || 2 || Integer | ||
|- | |||
| vbLong || 3 || Long | |||
|- | |||
| vbSingle || 4 || Single-precision floating-point | |||
|- | |- | ||
| vbDouble || 5 || Double-precision floating-point | | vbDouble || 5 || Double-precision floating-point | ||
Line 24: | Line 32: | ||
|- | |- | ||
| vbObject || 9 || Object | | vbObject || 9 || Object | ||
|- | |||
| vbError || 10 || Error | |||
|- | |- | ||
| vbBoolean || 11 || Boolean | | vbBoolean || 11 || Boolean | ||
|- | |||
| vbVariant || 12 || Variant | |||
|- | |||
| vbDataObject || 13 || Data-access Object | |||
|- | |||
| vbByte || 17 || Byte | |||
|- | |- | ||
| vbArray || 8192 || Array | | vbArray || 8192 || Array |
Revision as of 17:51, 18 May 2013
VarType(variable)
Description
VarType returns an integer that indicates the type of a variable. The required parameter, variable, is any variable that doesn't contain a user-defined type.
When variable is an array, the value returned is equal to the array constant plus the constant that specifies the element-type.
Table 25: VarType return values
Constant | Value | Description |
---|---|---|
vbEmpty | 0 | Empty |
vbNull | 1 | Null |
vbInteger | 2 | Integer |
vbLong | 3 | Long |
vbSingle | 4 | Single-precision floating-point |
vbDouble | 5 | Double-precision floating-point |
vbCurrency | 6 | Currency |
vbDate | 7 | Date |
vbString | 8 | String |
vbObject | 9 | Object |
vbError | 10 | Error |
vbBoolean | 11 | Boolean |
vbVariant | 12 | Variant |
vbDataObject | 13 | Data-access Object |
vbByte | 17 | Byte |
vbArray | 8192 | Array |
Example
Rem VarType Example 'VarType returns variable type as an integer Dim nInteger, nSingle nInteger = CInt(44) Print 44 & " is VarType " & VarType(nInteger) nSingle = CSNG(99.44) Print 99.44 & "isVarType" & VarType(nSingle)
Output
44 is VarType 2 99.44 is VarType 4