all groups > dotnet interop > january 2007 >
You're in the

dotnet interop

group:

Using a .NET COm Interop DLL from VB6


Using a .NET COm Interop DLL from VB6 Chad
1/19/2007 10:13:23 AM
dotnet interop:
Can someone please help? I have verylittle time to coirerct this issue:

Someone gave me the following .files compiled with Visual Studio 2005 from a
..NET library compiled with COM Interop.

Roberto2.tlb
Roberto2.dll

Not sure what I'm doing...On my PC, I executed these statements:

C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\regtlibv12.exe
C:\Roberto\Roberto2.tlb
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\regasm.exe
C:\Roberto\Roberto2.dll

I then ran this from VB6

Private Sub Form_Load()
Dim Test
Set Test = CreateObject("Roberto2.Test")
End Sub

It died on the Create object with the following error:

Automation error
The system cannot find the file specified.


Re: Using a .NET COm Interop DLL from VB6 JerryWEC
1/19/2007 12:16:11 PM
Hi everyone!

I'm having the same type of issues as Chad...

I'm trying to use my CLA_Logging.dll (VB.net 2005) in VB6. I have used the
following to create a type library...

tlbexp cla_logging.dll /nologo /silent /verbose
tlbexp cla_logging.dll /nologo /verbose

Both times the cla_logging.tlb file was created. (only 2k in size ???)

I have also tryed to do a regsvr32 cla_logging.tlb and this did not work. So
I tryed reg assembly tool...

regasm cla_logging /tlb:cla_logging.tlb

This to looks like it worked. However, when I reference the cla_logging.tlb
in VB6 the cla_logging object shows up in the object browser but I don't see
any of the public properties or methods of my class library.

What do I need to do to get this to work?

TIA! JerryM

Re: Using a .NET COm Interop DLL from VB6 Vili
1/21/2007 8:05:21 AM
Hi

If either you or Chad figure out whats need to be done to get this work
please write the answer to the news group. I am trying having the same
problem with my dll file.
Re: Using a .NET COm Interop DLL from VB6 Vili
1/21/2007 11:35:42 PM
Hi

Solved my problem.

1. Added strong key to my in project
2. Build the .dll file
3. used registered the .dll with regasm.exe myClass.dll
/tbl:myClass.tbl
4. Added the .dll file to Global assembly cache (in my
c:\windows\assembly)

After that it worked fine with my vb5 project

Here are few good tips on .NET interop with vb6
http://www.programmersheaven.com/2/vbrad-Interop

Tuomo
Re: Using a .NET COm Interop DLL from VB6 L-E Eriksson
1/25/2007 9:34:22 PM
Hello! It is not necessary to add a strong name and add it to the global
assembly cache, though this works well.

Here is an alternate approach:
1. Build the dll
2. Use regasm from visual studio command prompt: regasm.exe
c:\code\mycomponent.dll /tlb: mycomponent.tlb.
Using the tlb option enables early binding.
3. Place the mycomponent.dll in the same directory as your executing
assembly (your COM-assembly). This might be C:\Program Files\Microsoft
Visual Studio\VB98 if your using VB6 or C:\Program Files\Microsoft
Office\Office if you are using Excel.
4. Reference the component in your application
5. Write code for using your component.

Regards!

L-E Eriksson

[quoted text, click to view]

Re: Using a .NET COm Interop DLL from VB6 Vili
2/1/2007 4:53:38 AM
Hi

I tested this but it did not work on my vb5 application without the
strong name and gac. Not sure why

-Tuomo

[quoted text, click to view]
AddThis Social Bookmark Button