Groups | Blog | Home
all groups > vb.net upgrade > july 2003 >

vb.net upgrade : VB .NET DLL Used in VB 6.0


Veda
7/17/2003 8:46:50 AM
I created a vb .net dll that is a proxy class for a web
service. I am trying to add a reference to this dll in a
vb 6.0 project. I get the message "Can't add a reference
to the specified file." I can add a reference to this dll
in vb .net, but not vb 6. Does anyone know why I can not
use this dll in vb 6? Has anyone successfully done this?
If so, how? Any help is appreciated.

Patrick Steele [MVP]
7/17/2003 3:33:35 PM
In article <009001c34c7a$a34b5490$a301280a@phx.gbl>, veda.l.lassiter-
bryson@lmco.com says...
[quoted text, click to view]

You need to use REGASM to:

1) generate a COM-callable-wrapper (CCW)
2) Register your .NET object as a COM object

Use it in this format:

regasm /tlb:mydotnet.tlb mydotnet.dll

This will register "mydotnet.dll" as a COM object and will generate a
type library you can add a reference to in VB6. You'll also need to
consider giving your DLL a strong-name and placing it in the global
assembly cache (GAC). Or, you can simply place the mydotnet.dll in the
same directory as your VB6 executable.

Of course, if you just want to call a webservice from VB6, why not just
use the SOAP Toolkit?

--
Patrick Steele
Microsoft .NET MVP
vbdotnet NO[at]SPAM online.microsoft.com
7/17/2003 7:48:28 PM

VB.Net creates COM+ classes by default and VB6 creates COM classic
classes by default. You can use VB6 dll's in VB.Net because VB.Net
automatically creates a COM+ wrapper around COM classic classes.

You can use VB.Net classes in VB6 if you give the information
necessary for COM classic. Here's a link to some documentation:

ms-help://MS.VSCC.2003/MS.MSDNQTR.2003FEB.1033/dv_vbcon/html/vbconCOMInterop
InVisualBasicVisualC.htm

To create a COM classic class in VB.Net it's easiest to use the COM class
template. Here's a brief outline
1. Create a VB class library project
2. Delete the pre-existing class1.vb file that was created.
3. Right-Click on the project in the solution explorer, choose Add->New
4. When the dialog comes up choose the "COM class" ....it's roughly
halfway down the list.

This will automatically set up the attributes and COM Guid's necessary to
register for COM classic.

Let me know how this works out for you,
Herfried K. Wagner
7/17/2003 9:39:12 PM
Hello,

"Veda" <veda.l.lassiter-bryson@lmco.com> schrieb:
[quoted text, click to view]

The DLL must be registered for COM interop and classes must be marked as
ComVisible:

http://www.mvps.org/dotnet/dotnet/samples/codingtechnique/downloads/MyComLib.zip

Regards,
Herfried K. Wagner
--
MVP · VB Classic, VB .NET
http://www.mvps.org/dotnet

Veda
7/21/2003 2:15:54 PM
Thanks for the assistance.

I tried using the SOAP toolkit, but I could not get the
complex data types to work, nor authentication, which both
are a must for the application I'm working on. I don't
know if this is because we are using a Web Logic server on
the back end versus a IIS. Do you know if this makes a
difference?

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