COM interop problem

  • Thread starter Thread starter JJ
  • Start date Start date
J

JJ

I'm trying to call a .NET assembly from VB 6.0 using
CCW's - for learning purposes. I have followed several
tutorials to the letter and still fail:

I create the class library ( a simple Hello world class
called ManagedServer), run regasm with /tlb: option.

I am able to see the reference from VB's add reference
dialog. I then try to create the object and the
declaration seems to work fine. When trying to call the
object's methods, intellisense doesn't display them, which
makes me suspicious. Thenwhen I run the code I get the
following error:

File or assembly name ManagedServer, or one of its
dependencies, was not found.

I even went back and added [ComVisible(true)] on the
public method, have a single default empty contructor, and
added the attribute [ClassInterface
(ClassInterfaceType.AutoDual)] to the class. Intellisense
then displays the methods in VB 6.0, but when trying to
execute the VB 6 app, I still get the same error as
above. I have also try adding the ManagedServer to the
GAC, but that doesn't help either.

Am I forgetting something??? I thought COM could call
a .NET assembly if the above steps I have taken were
implemented?
 
Did you try copying the tlb and dll file to the same folder as the exe?
Also, I think if you enable 'Register For COM Interop' "it will do stuff to
make it work as a COM object."
 
Back
Top