
VB6 : Adding usercontrols using Controls.Add
I am building an explorer style application and want to be able to call any
kind of usercontrol
in a form. The main issue is that the usercontrols to be added are fully
configurable by the user.
--> I cannot include their ocx references in my main VB project.
Adding them to the form works fine using
Dim obj As Object
Set obj = pfrmParent.Controls.Add("MyLib.MyControl", "myCtl")
obj.Visible = True
However as soon as I call a custom property/method of this control I get a
438 runtime error (property/method not found).
If I add this component to my project (Ctrl-T) and use exactly the same
code, It works !!
--> I think VB includes some references in the exe file to know the methods
later on.
But I cannot add it to my project because I do NOT known in advance which
ones are going to be called !
Is there a way to make this late binding really work ???