Use .Net created dll in VB6?

  • Thread starter Thread starter awan
  • Start date Start date
A

awan

I need to call a .net created dll in VB6 project. It always give me this
error, when I create instance of this class

"error 2147024894(80070002) File or assembly name DllName, or one of its
dependencies, was not found."

This error was happened on a machine with .net runtime installed only. It
runs fine in a machine with .net developer version installed.

Does anybody has any idea? Thanks a lot!
 
There are the steps to follow:

1) Create a class library in VS choose whatever language you want either Vb.NEt or C#
2) Goto to Project Properties->ConfigurationProperties->build, check the Register for Com Interop checkbox. This creates the COM wrapper for your .NET assembly and hance need not use regasm.
3) Write whatever code you want, expose the classes publicly, expose the properties, functions you want publicly.

Now in your VB project, add the claslibrary.tlb created by the above program.
Now use the classes and fucntions as you want.

you shoudl not have any problem.
I need to call a .net created dll in VB6 project. It always give me this
error, when I create instance of this class

"error 2147024894(80070002) File or assembly name DllName, or one of its
dependencies, was not found."

This error was happened on a machine with .net runtime installed only. It
runs fine in a machine with .net developer version installed.

Does anybody has any idea? Thanks a lot!
 
Hello awan,

When you deploy a .NET DLL, and you want to use it with COM (such as VB),
you need to register it with "Regasm.exe your_aseembly_file /codebase".
you need to include the /codebase switch when registing assembly in folders
other than GAC.

To use the /codebase switch, the assembly must be strongly-named.
 
Back
Top