How to create controls dynamicaly, and latter to use them trough array.
Please email answer to [email protected]
Thanks
Printable View
How to create controls dynamicaly, and latter to use them trough array.
Please email answer to [email protected]
Thanks
Hi,
Have the desired control with index 0. To load controls dynamically call "LOAD" control function with a new index. For example,
lets say we have a Textbox control txtCntrl indexed 0 at design time.
At run time u say
..........
........
Load txtCntrl(1)
.......
...........
in the similar way u unload the controls.
Does that answer u'r question
VB 6 also allows to add controls dynamically at run time without need to have an array. The example of adding Text Box:
private Sub Form_Load()
Form1.Controls.Add "VB.TextBox", "txtMyText"
With Form1!txtMyText ' you can also use next sintax
'With Form1.Controls("txtMyText")
.Visible = true
.Top = 500
.Left = 1000
.Width = 2000
.Height = 315
.Text = "It Works!"
End With
End Sub
Just paste this code into empty form and run.
HTH
Vlad