Universal Data Type Changes in Visual Basic
Visual Basic .NET 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 .NET
In Visual Basic .NET, 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 .NET, 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:
Dim SomeObj As 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())
Data Types | Value Types and Reference Types | Object Data Type | System Namespace | Object Class | Type Class | VarType Function | VariantType Enumeration | Programming Element Support Changes Summary