I created a C# COM accessible dll that I want to consume in VB6 I was able to consume in VB6 my COM object with a hard reference to the TLB. What I am trying to do now is to remove this reference and load it dynamically I am creating it as follows:
Dim keylok As Object
Set keylok = CreateObject("MyClassLib.MyObject")
I get the Run-time error 424 "Object Required" once I hit the second line. But when I create it as follows:
Dim keylok As MyObject
Set keylok = CreateObject("MyClassLib.MyObject")
It works fine. I am not sure why would that make a difference. Anyway I cannot use the second one because I would still need to have the physical reference.
I tried also as a sort of debugging to write to file in my COM object constructor to if it really gets called. And yes it does, I'm even able to call other methods in my COM object sucessfully inside the constructor.
I was even able to load dynamically and consume it from another C# app using:
dynamic myObj = Activator.CreateInstance(Type.GetTypeFromProgID("MyClassLib.MyObject"));
Did any one encounter something like that before?
Activator.CreateInstance(T)is working via the CCW generated from the typelib rather than IDispatch. For the giggles, try the project at codeproject.com/Articles/74528/C-COM-Late-Binding-Event , and if that works, compare/contrast that with what you're doing in your project.