COM Objects

  • Thread starter Thread starter Todd
  • Start date Start date
T

Todd

I've got a VB6 COM DLL that I'm trying to call from
within .Net. Problem is that the public properties that
I'm trying to set the values of aren't typed in the DLL.
And .Net will not let me assign anything to them, not even
a string value. It gives me a type mismatch error. It
shows in the IDE that they are of type 'Object'.

I've tried creating a variable of type 'Object', assigning
the string value to it (which worked fine), and then
assigning my variable of type 'Object' to the COM DLL
property (of type 'Object')... same type mismatch error.

Any ideas?

Todd
 
The default data type in VB 6 is "variant" and that data type does not exist
in .NET. In .NET the default data type is "Object". If you didn't type
your properties in VB 6, then your COM object will think that the inbound
information is of the variant type, but object and variant don't work.

Can you go back and type the properties in VB 6?
 
create another VB6 com component to call the old one. In the new one, put
real types on the parameters.
Connect your VB6 app to the new component and let it proxy the calls for
you.

Hope this helps,
--- Nick
 
Back
Top