Using VB.NET object in VB 6.0 project

Using VB.NET object in VB 6.0 project

Post by Mr Si » Sun, 21 Nov 2004 16:07:08

Hello, My company is experimenting with adding VB.NET classes to currently
existing VB 6 code. The idea is to gradually migrate to a purely object
oriented solution. When I run the code in development environment it works
fine - but when I sent the dll (NET) I created and the Interop.dlls along
with the exe to be reviewed, the reviewer got an error "Could not create
ActiveX control". I asked if he had registered them and it turned out
registering gave an error (~ could not load library...).
I assume if the entire .NET framework was installed on the test machine it
would work but I would like to know what could be done outside of running a
full 'install' of the application to be tested. ie. we want to just 2
click on the exe, run it and have it invoke the .NET dll.
Also, do we have to register the tlb file on the target machine?

Any help would be GREATLY appreciated!

Using VB.NET object in VB 6.0 project

Post by Cor Ligthe » Mon, 22 Nov 2004 19:15:10

Mr Sir,

Did you know that there is a special upgraders newsgroup for vb


Probably you find your answer there faster.

It is not very active however I thought, that almost every question is

I hope you get your solution.




Using VB.NET object in VB 6.0 project

Post by UAErro » Mon, 22 Nov 2004 23:41:47

Sounds like you already created the CCW (COM Callable
Wrapper) and moved it with the assembly over to the Testing
Machine. However I see no evidence that you registered the
assembly on the test machine with Regasm.exe (analogous to
using regsrv32.exe for a COM Component). This really is a
step that should be performed by the application's setup

In general:

To make .NET assemblies available to applications that use
COM you need to use this:

NET Framework Tools Assembly Registration Tool (Regasm.exe)

.NET Framework Developer's Guide Registering Assemblies
with COM

see also
.NET Framework Tools Type Library Exporter (Tlbexp.exe)

You may also have to add some code/attributes to the .NET
code to supply additional COM metadata/functionality.

.NET Framework Developer's Guide: Exposing .NET Framework
Components to COM

Visual Studio: Deployment Projects

This article might also illuminate some of the issues you
are dealing with

Microsoft Office and .NET Interoperability

Using VB.NET object in VB 6.0 project

Post by smit » Sun, 05 Dec 2004 08:00:39

Best help for you and your coworkers on the project is to go to your local
bookstore today and get Rockford Lhotka and BIlly Hollis' "Professional
Visual Basic Interoperability: COM and VB6 to .Net"

I think it only had a .Net1.0 version ... if it's at your store get it
anyway. The main stuff you need is in it and the differences will be more
easy to figure out after you've read the first several chapters of this

If it's not at your store then rush it from amazon, they've got a deal on it
because of the death of WROX press.

There are other Interop books, some with lots more neat-geeky code that will
make you think that your money will go farther on them ... but it sounds
like you need a crash course and you need it in a syntax that will make it
work for you. This is the book.

Robert Smith
Kirkland, WA