Export (0) Print
Expand All

Universal Data Type Changes for Visual Basic 6.0 Users

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

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.

In Visual Basic 2008, 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 2008, 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
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())


Community Additions

ADD
Show:
© 2015 Microsoft