Using C# assemblies from VB6 code. Some issues.

Posted by AngryHacker on Stack Overflow See other posts from Stack Overflow or by AngryHacker
Published on 2010-04-12T20:16:18Z Indexed on 2010/04/17 2:33 UTC
Read the original article Hit count: 241

Filed under:
|
|
|
|

I have a C# assembly, which is regasmed, but is not in the GAC. In my VB6 code, I added a reference to the generated type library (the .tlb file).

Then I instantiate the C# lib in my VB6 code. If I run it from the VB6 IDE, it does not work. The Set in the code below:

Dim obj as MyCSharpNamespace.MyCSharpObject
Set obj = New MyCSharpNamespace.MyCSharpObject

causes this error:

Automation error 
The system cannot find the file specified

However, if I compile the VB6 project to an EXE and run it, it runs perfectly fine.

I should add that all the VB6 project files (e.g. forms, modules, etc...) are in the same folder as the C# DLL and TLB.

So why can't I run it from the IDE environment?

© Stack Overflow or respective owner

Related posts about c#

Related posts about vb6