vb6user-controlsctl

VB6 update/reload a CTL user control used in my project


I have an old VB6 project that uses a CTL user control. I can see the user control on the toolbox.

If I create a new form inside the project, and I try to add the user control, it fails because "Error loading DLL" and the control cannot be added.

But if I create a new project, I can add the user control to the project, and then use it in a new form without problem.

What is wrong in the first project, that I cannot use the user control in its forms?

In the same way, opening the forms of the project where the user control is already used, the control is not recognized. Seems something related to a wrong path/reference for the user control on the original project.

I've tried to add the user control again, but it tells me that already exists a user control with the same name.

And if I try to quit the user control to load it again, I cannot quit it because is being used in the project. What can I do?

Thanks for your help.


Solution

  • Don't ask me why, but the only way to succeed was to start from scratch. I've started with a clean Windows XP laptop with Visual Studio SP6 installed.

    When trying to load and compile the project, the same error appeared. The same if I tried to draw a new instance of my user control: Error loading DLL And the same if I tried to open a Form with instances of my user control inside: the control was not recognized in the form (empty areas).

    So, I started a new empty ActiveX DLL project. Adding all the objects step by step, I could load all of them (with some small problems) but finally I could compile the project.

    The order for adding the objects was important: References & Components, User Controls, Modules & Classes, Designers, and finally Forms.

    I was trying to compile on each step to catch the reason of the problem, and to know the next object that had to be added. But don't understand exactly why it works now. Thanks anyway!

    EDIT 2018-11-07:

    I've discovered a work around on the initial project, to use the CTL user control without problem, and to compile the project without any error message. I want to share it here to help anybody with a similar problem.

    I don't know why, maybe anybody can give an explanation, but if I open the project, and then open the designer called frmDate (see the image), from that moment then I can compile the project, and use the user control on any form. What is going on??

    enter image description here