Hi!
Am trying to create a C#.NET dll and use it in VB6.0 application. I've created the class library, generated the type library using tlbexp.exe, registered it using regasm.exe, but after referencing the tlb file in VB6.0, it says "ActiveX component can't create object". Am using MS Visual Studio 2005. The VB application runs on a different computer where the C#.Net class library was created.

Any Suggestions .... anybody?

Recommended Answers

All 4 Replies

How are you deploying the assembly? You didn't mention gacutil.exe in your steps so unless the assembly is in the same folder as the calling application (like vb6.exe) then it won't be able to find it because the path to the assembly isn't registered in the GAC.

Try copying the assembly to the application folder and see what happens. If that fixes it you should probably include gacutil.exe in the registration steps.

I copied the assembly to the application folder. When i instantiate the object as follows

Dim i As New Demo1.Numbers

it sees the class and the methods. but when i try to use them it doesnt work. It still says "ActiveX component can't create object".

It brings an error on this statement

MsgBox " The date today is " & i.GetDay

what could be the problem considering that it can see the library and its methods, but it cannot create the object?

I've actually figured it out. After copying the assembly to the application folder, all i needed to do was to run regasm.exe again in the target computer. It now works ok.

... Thanks alot Hamrick for easing the burden.

Regards
Fraogongi

You have to register the assembly on every computer that it's used. regasm does two things. It makes a type library, but it also puts an entry for the ProgId of the assembly into the HKEY_CLASSES_ROOT registry hive. If you don't register on the target machine, that entry isn't there and your assembly is COM visible, but not COM runnable...if that makes sense. :)

I'm sorry, I assumed you were talking about the target machine when you said you registered the assembly.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.