Need to Programmatically add a UserControl onto my UserControl
Posted on 2003-03-12
I'm using VB 6.0, and created an ActiveX Control Project. My main control (.ctl) which was created along with my Project needs to be able to dynamically/programmatically place within it another control (.ctl) which I created as an User Control in the same project. Let's say I have a "UserControl1.ctl" as the main, and a "UserControl2.ctl" as a control that is placed on the first. The method I tried just to get it declared was:
Private m_abc As UserControl2
Private Sub Initialize()
Set m_abc = New UserControl2
You can do the above for a form, but when it comes to a control, I can't do a "Set". I hope to be able to obtain UserControl2 as a variable within UserControl1's code and then assign it (UserControl2) to a position and have access to all of the components of "UserControl2". The way I don't want to do it is to drag the UserControl2's icon from the bar onto the UI of UserControl1, I would like to do that programmatically. I would be happy to provide more details if I was confusing. Source code would be of great value. Thanks...