Replace Variant with Object

The Variant type was implemented in VB6 to support COM. Variant types have been replaced with Object types in Visual Basic .NET. Where you would have used a Variant in VB6, use an Object in Visual Basic .NET.

Tip

When you type the word Variant as a data type, Visual Studio .NET—the code editor—replaces it with the Object type.

There are several other noteworthy facts regarding Variant types. The Variant keyword still exists in Visual Basic .NET, but it is a do-nothing reserved word that has no meaning. And, finally, in VB6, if you performed arithmetic that resulted in a number too big for a data type—for instance, adding two integers whose sum was greater than the maximum value for integers—VB6 converted the result ...

Get Visual Basic® .NET Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.