Creating Text Boxes at run-time

How would I create text boxes at run time, then manipulate or add text to them? Can this be done?
LVL 2
cantrellAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
schildConnect With a Mentor Commented:
all you have to do is changing the Index value
because you cant repeat loading the same control several times
so if you want to load 10 controls do like this

For CtrlIndx = 1 to 10
  Load TextBox1(CntrlIndex)
  TextBox1(CtrlIndx).Visible = True
  TextBox1(CtrlIndx).Top = TextBox1(CtrlIndx).Top + 500*CtrlIndxNext
Next

0
 
mark2150Commented:
I think you need to start with a control array for the first text box and then you can dynamically add elements to the array. However the control itself cannot be created from scratch in VB5. VB6, I have heard, allows this.

M

0
 
cantrellAuthor Commented:
Could you give me an example?
0
 
schildCommented:
You put one TextBox in the form, you may want to make it invisable. Then you set the "Index" property to 0.

At runtime you doing this:
Load TextBox1(1)
TextBox1(1).Visible = True
TextBox1(1).Top = TextBox1(1).Top + 500

Good Luck
Schild
0
 
cantrellAuthor Commented:
Ok, that creates one text box. Now, how about the others?
0
All Courses

From novice to tech pro — start learning today.