For an unknown reason, VB6 doesn’t interact the same way with UserControl than other object.
I have a class that require to hold a graphical interface, a user control and need to be set to be later used from the get method. I have try many thing like using the special class VBControlExtender but without any success.
Here is what I have so far:
Class that hold variables and the user control:
'...
Private WithEvents m_uGUI As VBControlExtender
Public Property Get GUI() As VBControlExtender
Set GUI = m_uGUI
End Property
Public Property Set GUI(ByVal uValue As VBControlExtender)
Set m_uGUI = uValue
End Property
'...
Call of the class that cannot compile:
Set myObject.GUI = new ucMyUserControl
Any idea?
From the help on this error (it mentions ListBox and Form, but the same applies to UserControls):
What you want to do is make an array of your UserControls and load new ones as you need them. Set the Index property of your UserControl to 0 to make it an array and then use the Load statement to create new instances:
When you need more just specify a new upper bound:
When you’re done with them, unload them: