VarType: Difference between revisions

From NSB App Studio
Jump to navigation Jump to search
No edit summary
No edit summary
Line 51: Line 51:
== Related Items ==
== Related Items ==


[[is (operator)|IS]], [[typename|TYPENAME]]
[[is (operator)|Is]], [[typename|TypeName]]


[[Category:Language Reference]]
[[Category:Language Reference]]

Revision as of 01:52, 24 August 2012

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
vbInteger 2 Integer
vbDouble 5 Double-precision floating-point
vbCurrency 6 Currency
vbDate 7 Date
vbString 8 String
vbObject 9 Object
vbBoolean 11 Boolean
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

Related Items

Is, TypeName