-
Im using this to create buttons at run time, draggin them from another form
Code:
Set Boton = frmDropWindow.Controls.Add("VB.CommandButton", ControlName)
Is there a way to make a control array of them?, because when one is created, the older one stops working, so they are pretty much useless.
Thanks :0
-
Once you create the 1st control, set the Index to 0 then create the same control again (with the same name) and it'll automatically go to 1, 2, 3 etc.
-
<?>
I didn't think you could set the index at run time.
-
Nope, the index cant be changed during run time :(
im toying now with object.ContainedControls
im still looking for info on it, there seems to be a way with that, havent found an example yet :(.
Thanks for the time :)
-
naming the buttons
got this code from kedaman the other time,
Set Boton = frmDropWindow.Controls.Add("VB.CommandButton", "ControlName" & arrayNumber)
Just add the array number to the controlname, producing a ControlName1, ControlName2, etc..keeps the names unique
Works great!