H
Howard Kaikow
I'm doing a VB 6 project in which I am trying to protect against type
mismatch errors.
Is the process any different in VB .NET?
Here's what I'm doing in VB 6.
I have an ActiveX DLL.
The class has stuff initialized by calling a sub SetClass that wants some
Word specific objects passed-in.
If the user mistakingly uses the wrong object, say, uses an Excel object
instead of a Word object, a nasty type mismatch error is generated when I
try to use the variable.
To avoid this error, I set all the args to, ugh!, Variant, and then use
TypeName to test the arg and then use On Error to catch any error when first
using the object.
Would the same methodology work in VB .NET by using Object instead of
Variant.?
According to the VB .NET in a Nutshell book (page 560), TypeName in VB .NET
has some behaviorial differences from TypeName in VB 6.
So, how wouldone make code "type mismatch proof" in VB .NET?
mismatch errors.
Is the process any different in VB .NET?
Here's what I'm doing in VB 6.
I have an ActiveX DLL.
The class has stuff initialized by calling a sub SetClass that wants some
Word specific objects passed-in.
If the user mistakingly uses the wrong object, say, uses an Excel object
instead of a Word object, a nasty type mismatch error is generated when I
try to use the variable.
To avoid this error, I set all the args to, ugh!, Variant, and then use
TypeName to test the arg and then use On Error to catch any error when first
using the object.
Would the same methodology work in VB .NET by using Object instead of
Variant.?
According to the VB .NET in a Nutshell book (page 560), TypeName in VB .NET
has some behaviorial differences from TypeName in VB 6.
So, how wouldone make code "type mismatch proof" in VB .NET?