Post

VB10 vs VB6: Variants are not supported.

This is part of series of posts categorized under VB10 vs VB6.

“Variants are not supported. Object is now the default data type.”

Wow! Really?!?!? Someone actually “defending” (or rather complaining) that Variants are not supported? In any case…

Based on the wording of the entry, it is completely false to say “Variants are not supported.”. They are completely supported. However, it is also true that Object is now the default data type. I know that seems a little confusing; so let me explain.

In VB6, the default “unknown” type was a Variant. In VB10, the base type (since VB10 is a true object oriented language) is Object; of which all types derive. It is also important to understand that Variant is not a native data type in VB10.

So how, you may ask, does VB10 have support for Variant if there isn’t a data type of Variant? Think about it for a moment. Where is Variant needed? VB4 (32-bit) through VB6 is a COM (aka ActiveX / OLE Automation) based product. Because of this, Variant made sense since this is a “native” type of the COM world. .NET has its own type system; of which Variant is not a “native” type. However, .NET is great about operating with other technologies which includes COM. Because of this, there is full support for the Variant data type when working with COM interfaces.

Verdict

VB10 does have support for Variants; so you be the judge.

This post is licensed under CC BY 4.0 by the author.