tags:

views:

440

answers:

1

I have developed an ActiveX control in VB 6.0. I have a placeholder in my ActiveX control, where I need to load a user control developed in VB 6.0 at runtime. The user control has to be part of another DLL/OCX file.

  1. How do I load the user control in VB dynamically?

  2. All the user controls have some common functionalities. Can I implement the common functionalities in the base class and write only specific code in user control?

+2  A: 
  1. You can load the control like any other control, using CreateObject. Then you have to assign the control as a child control to your container. (In a standard VB6 form you can do this with Controls.Add. (See this))

  2. This is possible only to a certain degree. COM/ActiveX is all about composition, there's no inheritance. You could create a helper class which provides the common functionality and is instanciated and used by the user controls.

DR