dotNet dlls in VB6?

P

Peter Plumber

OK, this is a rather strange request

Is it possible to use dot-net dlls in VB6 projects?
Is anyone doing this or is this completely useless?

thx

Peter
 
N

Nicholas Paldino [.NET/C# MVP]

Peter,

It is absolutely possible to use .NET dlls in VB6 projects. However,
you have to design your classes correctly so that they work with COM interop
correctly. Basically this means defining interfaces using Automation
compatable types, and then implementing them.

For more information, check out the tutorial in the .NET framework
documentation titled "COM Interop Part 2: C# Server Tutorial", located at
(watch for line wrap):

http://msdn.microsoft.com/library/d.../html/vcwlkcominteroppart2cservertutorial.asp

Hope this helps.
 
A

Ajay Kalra

One way would be to expose the managed code(.Net) functionality thru
COM for the unmanaged world(VB). There are possibly better ways than
this as this would require code change in .Net modules (comvisible
attribute).
 
D

Dot Net Team [MSFT]

This is definitely supported, and is pretty straightforward if you're using
the Visual Studio IDE.

Here's an overview
1. Create a VB class library project.
2. Add a new item using the "Com class" template.
3. Compile your project.

What this does is create the class, apply a comclass attribute, set the
correct GUID's for com interop, creates a VB6 class which wraps the VB.Net
class, registers the vb6 class.

Here's some docs you can look up:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/htm
l/cpconmarshalingdatawithcominterop.asp

Did this give you the info you needed?

--------------------
 

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