views:

82

answers:

4

I'm just wondering if there is something I should know of when doing this or will it work straight out of the bat as long as the .NET framework is installed on the client?

I ask because when I attempted this, VB6's references dialog said "cant register that dll"

Thanks

+3  A: 

You have to convert that to a COM dll. Regasm the dll and use it.Use comvisible attribute.

anivas
thank you for your answer, (upvoted)
Erx_VB.NExT.Coder
+6  A: 

There is a project setting "Make assembly COM-Visible" in the "Assembly Information" section. Make sure you tick it.

endy_c
thank you for your answer, (upvoted)
Erx_VB.NExT.Coder
FYI - adam nathan's book is the bible on this topic
pm100
+3  A: 

Building on the other answers, .NET DLLS, even when they expose COM objects for use, as described in the other answers, DO NOT CONTAIN an embedded typelib so you unfortunately can't use what you're used to when dealing with COM libraries, RegSvr32.exe.

As Anivas pointed out, you have to use RegAsm.exe to register the .net assembly (the dll), and then VB6 should be able to see it (Add a reference to it in your VB6 project, the use the object browser to check what objects have been exposed).

drventure
thank you, so is regasm just the .net version of regsvr32 which registers .dll's for windows wide recognition (or for GAC) or is it just a process which creates a typelib that VB6 can understand for the .net .dll in question? thanks Dr. :) (upvoted)
Erx_VB.NExT.Coder
No problem. Regasm actually does register the DLL's COM interfaces and such in the registry so that other COM apps can make use of it. The VS compiler generates the TLB file and other interop files when you compile your app IF you have the COM options checked on the compile screen in visual studio
drventure
+1  A: 

A little other information that might be useful: a .Net DLL isn't compiled code, it's written in "Intermediate Language" (IL). You may find it interesting to open a .Net DLL with any text editor and look at it.

BobRodes
Thanked mate, upvoted :)
Erx_VB.NExT.Coder