I am having problems when using a VB.NET dll in a VB6 program. I have already created my dll with the GuidAttribute, used the RegAsm to create a tlb and added it to the references of my VB6 program. The problem is when I try to create the object using CreateObject function, however the following error shows up "ActiveX component can't create object."
I don't know if I am missing any declaration on VB.NET to use it as a dll or if I am not using the CreateObject function properly.
you have to make sure your component is properly registered for com interop.. in the projects properties tab there is a checkbox option for enabling this, you are acutally on the right path with creating a type lib that you can reference in vb6, you can simple add reference to it like any other com compenent. however actually register it rather than creating a tlb file.
When you register an assembly for use by COM, Regasm.exe adds entries to the registry on the local computer. More specifically, it creates version-dependent registry keys that allow multiple versions of the same assembly to run side by side on a computer. The first time an assembly is registered, one top-level key is created for the assembly and a unique subkey is created for the specific version. Each time you register a new version of the assembly, Regasm.exe creates a subkey for the new version.
After registering an assembly using Regasm.exe, you can install it in the global assembly cache so that it can be activated from any COM client. If the assembly is only going to be activated by a single application, you can place it in that application's directory.
if you are interested in what the tool generates for the registry use
regasm {Path to your Assembly}.dll /regfile:myTest.reg
Hard to say with the info you've provided, but it sounds like you didn't make the assembly findable. From MSDN:
A complete article about Calling .Net Classes from Visual Basic 6: http://www.devsource.com/c/a/Using-VS/Calling-Net-Classes-from-Visual-Basic-6/
Creating a COM DLL with VS 2005: A walk through: http://www.codeproject.com/KB/COM/VS2005ComDllWalkThru.aspx