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.
Veda
Patrick Steele [MVP] - 17 Jul 2003 20:33 GMT
> 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
[quoted text clipped - 3 lines]
> use this dll in vb 6? Has anyone successfully done this?
> If so, how? Any help is appreciated.
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?

Signature
Patrick Steele
Microsoft .NET MVP
http://weblogs.asp.net/psteele
Veda - 21 Jul 2003 22:15 GMT
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?
>-----Original Message-----
>> I created a vb .net dll that is a proxy class for a web
[quoted text clipped - 22 lines]
>Of course, if you just want to call a webservice from VB6, why not just
>use the SOAP Toolkit?
Herfried K. Wagner - 17 Jul 2003 20:39 GMT
Hello,
"Veda" <veda.l.lassiter-bryson@lmco.com> schrieb:
> 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
[quoted text clipped - 3 lines]
> use this dll in vb 6? Has anyone successfully done this?
> If so, how? Any help is appreciated.
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
Dot Net Team [MSFT] - 17 Jul 2003 20:48 GMT
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,