Hi,
I was hoping someone would be able to help me.
I am sending a UserControl Name to a function. The
function is recieveing the Name into a variant variable
called vOption.
Does anyone know how I can open the User Control
through code.
:D
Thx
IJ
Printable View
Hi,
I was hoping someone would be able to help me.
I am sending a UserControl Name to a function. The
function is recieveing the Name into a variant variable
called vOption.
Does anyone know how I can open the User Control
through code.
:D
Thx
IJ
I can't test this one at the moment, but could you not use :
type thing ?Code:Dim ActX as object
Set ActX = Createobject(strconv(vOption))
Set ActX = new vOption
With ActX
.container = form1
....
Can't test this either. I thought you couldn't create controls with CreateObject, only new instances of classes.
Wasn't sure on this one, so needed to look it up for you, scrub that - I think you're right that you can't use the createobject option for this.
Take a look at the paragraph heading "Dynamic Control Creation" from this web site / page ... and it shows how to add it with the Controls method :)
I have seen the light and it is good.
My god, I have been wondering how to dynamically create a control at runtime since I bought vb5. I now know that it's not possible in vb5 without heavy API usage, but vb6...this is great!!!
Francesco Balena wrote an article in VBPJ about 2 or 3 years ago about creating controls dynamically (ie: not using the Controls.Add method) that works a treat. I've it in production apps, had not problems
- gaffa