VarType Description Returns a value indicating the subtype of a variable.Syntax VarType(varname)The varname argument can be any variable. Return Values The VarType 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 Note These constants are specified by Visual Basic for Windows CE run time. As a result, the names can be used anywhere in your code in place of the actual values.Res The VarTypenever returns the value for Array by itself. It is always added to some other value to indicate an array of a particular type. The value for Variant is only returned when it has been added to the value for Array to indicate that the argument to the VarType is an array. For example, the value returned for an array of integers is calculated as 2 + 8192, or 8194. If an object has a default property, VarType (object) returns the type of its default property.
Description
Returns a value indicating the subtype of a variable.Syntax
VarType(varname)The varname argument can be any variable. Return Values
The VarType 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
Note These constants are specified by Visual Basic for Windows CE run time. As a result, the names can be used anywhere in your code in place of the actual values.Res
The VarTypenever returns the value for Array by itself. It is always added to some other value to indicate an array of a particular type. The value for Variant is only returned when it has been added to the value for Array to indicate that the argument to the VarType is an array. For example, the value returned for an array of integers is calculated as 2 + 8192, or 8194. If an object has a default property, VarType (object) returns the type of its default property.
如果是明确定义的,用TypeName
TypeName 函数
返回一个 String,提供有关变量的信息。语法TypeName(varname)必要的 varname 参数是一个 Variant,它包含用户定义类型变量之外的任何变量。说明TypeName 所返回的字符串可以是下面列举的任何一个字符串:返回字符串 变量
对象类型 类型为 objecttype 的对象
Byte 位值
Integer 整数
Long 长整数
Single 单精度浮点数
Double 双精度浮点数
Currency 货币
Decimal 十进制值
Date 日期
String 字符串
布尔 布尔值
Error 错误值
Empty 未初始化
Null 无效数据
Object 对象
Unknown 类型未知的对象
Nothing 不再引用对象的对象变量
如果 varname 是一个数组,则返回的字符串可以是任何一个后面添加了空括号的可能的返回字符串(或 Variant)。例如,如果 varname 是一个整数数组,则 TypeName 返回 "Integer()"。