Problems with registering a .tlb file


The situation is as follows:

I have created a small class library project in C # that allows me to perform certain operations. The name of the created file is, for example, MyFirm.cs .

But since I need the component generated from C # to be reused in Visual Basic 6.0, it was necessary to create a .tlb extension file. Therefore, using some tools to generate it, I managed to create the files: MiFirma.dll, MyFirm.netmodule, MyFirm.snk and MyFirm.tlb; being the one required to use it in Visual Basic 6.0 the final file MyFirm.tlb .

Then, since I have the Visual Basic 6.0 project on my computer, I refer to the MyFirm.tlb file and it works normally.

The problem is in using only the executable generated from Visual Basic 6.0 (ex: MiFirma.exe ), supposedly referenced with MyFirm.tlb, on another computer that does not have Visual Basic 6.0 installed (that is the idea), load the application normally, but when I want to use the function of the MyFirm.tlb component, the error appears: "The ActiveX component can not create the object".

What could be happening? Because I am using the commands "regasm.exe", "regtlib.exe", I follow the steps to "create the .tlb" directly on the other computer, and nothing. Suddenly I will be doing it incorrectly.

Could you please help me! Thanks!

asked by Oscar WVD 24.08.2016 в 19:55

2 answers


When I needed, if I remember correctly, I would do the following:

  • I generate my dll and together with the file .tlb it is located in the path C: \ windows \ system32 \ (C: \ windows \ Syswow64 \ for 64-bit computers)

  • Register the dll from the cmd in administrator mode C: \ windows \ system32 \ regsvr32 C: \ windows \ system32 \ dllname.dll (C: \ windows \ system32 \ regsvr32 C: \ windows \ syswow64 \ dllname.dll for 64-bit computers)

  • In the vb6 project I refer to the .tlb and then compile to generate the exe

  • Once the vb6 project exe has been generated, I take the files (.dll and .tlb) with the executable

  • On the computer where my program is going to be running I also put the two files in the C: \ windows \ system32 \ (C: \ windows \ Syswow64 \ for 64-bit computers) and register them as in the Step 2

  • answered by 31.08.2017 в 23:07

    friend, what I did was the following.

    from the cmd run as administrator on the computer where I run the .exe

    I searched for the location of regasm.exe and run the following line

    C: \ Windows \ Microsoft.NET \ Framework \ v4.0.30319 > RegAsm.exe C: \ Windows \ System32 \ Api.dll / tlb: C: \ Windows \ System32 \ Api.tlb

    I copied both to the system32, I really do not know if it is necessary, but it worked for me.

    Tell me how you are doing.


    answered by 31.08.2017 в 22:44