Click to See Complete Forum and Search --> : converting between VB6 and VB .NET


hajer
April 3rd, 2003, 10:46 AM
Hi,

I have installed Visual Studio .NET and i want to build a VB project, the problem i encountred is :

i couldn't use the Variant type and every Variant is changed by Object, this type object causes errors when executing...
how can i use the same type or use a similar type a variant.


:confused:

coolbiz
April 3rd, 2003, 01:17 PM
Well that is one of the big changes in VB.NET. No more slow and un-optimized VARIANT type. Remember that all .NET languages must conform to the .NET data types and VARIANT is not one of them.

You basically have to change all VARIANT type to OBJECT and then use CTYPE() or DIRECTCAST() functions to convert them to the right TYPE when you need to use it. .NET is STRONGLY TYPED.

-Cool Bizs

DSJ
April 3rd, 2003, 02:29 PM
If you're using a lot a variant data types the code should/could be re-writen using "real" types. This will improve performance, stability, readability and maintainability. Variants always have been a "bad practice".