Skip to content

TypeName

Returns a String that names the type of a variable.

Syntax: TypeName( varname )

varname
required A Variant containing any variable except a variable of a user-defined type.

The string returned by TypeName is one of the following:

String returnedVariable
objecttypeAn object whose type is objecttype.
ByteByte value.
IntegerInteger.
LongLong integer.
SingleSingle-precision floating-point number.
DoubleDouble-precision floating-point number.
CurrencyCurrency.
DecimalDecimal.
DateDate.
StringString.
BooleanBoolean.
ErrorAn error value.
EmptyUninitialized.
NullNo valid data.
ObjectAn object.
UnknownAn object whose type is unknown.
NothingAn object variable that doesn't refer to an object.

If varname is an array, the returned string can be any of the strings above (or Variant) with empty parentheses appended. For example, TypeName of an array of integers returns "Integer()".

Example

This example uses TypeName to return information about a variable.

vb
Dim NullVar As Variant, MyType As String
Dim StrVar As String, IntVar As Integer, CurVar As Currency
Dim ArrayVar(1 To 5) As Integer
NullVar = Null
MyType = TypeName(StrVar)             ' Returns "String".
MyType = TypeName(IntVar)             ' Returns "Integer".
MyType = TypeName(CurVar)             ' Returns "Currency".
MyType = TypeName(NullVar)            ' Returns "Null".
MyType = TypeName(ArrayVar)           ' Returns "Integer()".

See Also

twinBASIC and LOGO copyright of "WaynePhillipsEA" author