This documentation is archived and is not being maintained.

Universal Data Type Changes for Visual Basic 6.0 Users 

Visual Basic 2005 updates the universal data type for interoperability with the common language runtime.

Visual Basic 6.0

In Visual Basic 6.0, Variant serves as the universal data type. This means that you can store data of any type in a variable of type Variant.

Visual Basic 2005

In Visual Basic 2005, Object is the universal data type. A variable of type Object can hold data of any type. The Variant type is not supported, and all its functionality is supplied by Object.

Variant is still a reserved word in Visual Basic 2005, even though it has no syntactical use. This helps avoid confusion with its former meanings.

The VarType function returns a member of the VariantType enumeration that provides the data type classification of an object variable. You can also use classes in the System namespace to obtain numeric data type information for an Object instance, as shown in the following code:

' Visual Basic 2005
Dim SomeObj As New Object
' ... ... ... ...  SomeObj is assigned some value during processing. 
' ... ... ... ...  Now we want to find out the data type of SomeObj. 
Dim Dtype As Integer      ' To hold numeric data type result. 
Dtype = Type.GetTypeCode(SomeObj.GetType())

See Also