Using VB.NET object in VB 6.0 project

M

Mr Sir

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!
 
C

Cor Ligthert

Mr Sir,

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

microsoft.public.dotnet.languages.vb.upgrade

Probably you find your answer there faster.

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

I hope you get your solution.

Cor
 
U

UAError

Mr Sir said:
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!

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
project.

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)
http://msdn.microsoft.com/library/d...ml/cpgrfassemblyregistrationtoolregasmexe.asp

..NET Framework Developer's Guide Registering Assemblies
with COM
http://msdn.microsoft.com/library/d...de/html/cpconregisteringassemblieswithcom.asp


see also
..NET Framework Tools Type Library Exporter (Tlbexp.exe)
http://msdn.microsoft.com/library/d...ls/html/cpgrfTypeLibraryExporterTlbExpexe.asp

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
http://msdn.microsoft.com/library/d.../cpconexposingnetframeworkcomponentstocom.asp

Visual Studio: Deployment Projects
http://msdn.microsoft.com/library/d...o7/html/vbconwhichtypeofdeploymentproject.asp

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

Microsoft Office and .NET Interoperability
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnofftalk/html/office11012001.asp
 
S

smith

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
book.

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
www.smithvoice.com.


....
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top