Data Type Changes for Visual Basic 6.0 Users
Collapse the table of content
Expand the table of content
This documentation is archived and is not being maintained.

Data Type Changes for Visual Basic 6.0 Users 

Visual Basic 2005 updates data types for interoperability with other programming languages and the common language runtime. The changes affect data type declaration, usage, and conversion.

Visual Basic 6.0

In Visual Basic 6.0, you use the Deftype statements — DefBool, DefByte, DefCur, DefDate, DefDbl, DefDec, DefInt, DefLng, DefObj, DefSng, DefStr, and DefVar — to set a variable's default type.

Use the Currency data type for calculations involving money and for fixed-point calculations.

A Date is stored in a Double format using eight bytes.

If two Variant variables containing integers are multiplied, an overflow condition causes the data type of the result to be changed to Double.

Use the LSet and RSet statements to copy a variable of one user-defined type to another variable of a different user-defined type.

Visual Basic 2005

The Deftype statements are not supported in Visual Basic 2005. The Currency data type also is not supported. Instead, use the new Decimal data type, which can handle more digits on both sides of the decimal point, for all money variables and calculations. Decimal is also directly supported by the common language runtime.

In Visual Basic 2005, the Date data type uses the common language runtime DateTime data type, which is an eight-byte integer value. Because of these different representations, there is no implicit conversion between the Date and Double data types. To convert between Double and the Visual Basic 6.0 representation of Date, use the ToOADate and FromOADate methods of the DateTime structure in the System namespace.

If multiplication of two Object variables containing integers results in an overflow, the result is changed to the 64-bit Long data type.

You cannot use LSet and RSet to assign one data type to another. Doing this requires a type-unsafe operation, particularly with structures, which could result in unverifiable code.

See Also

Show:
© 2016 Microsoft