Add Controls At Run-Time

'Add TextBox to your form (named Text1).
'In the textbox Property (To show the textbox property, mark it by clicking
'on it and then press F4) change the Index propery to 0
'This Sample will show you how to add Textboxes at run time.
'You will get new textbox named Text1(1).
'Of course you can do the same thing with other controls.
'Insert the following code to your form:

Private Sub Form_Load()
Load Text1(1)
Text1(1).Left = 400
Text1(1).Top = 400
Text1(1).Visible = True
'To add more then one textbox, simply add:
'Load Text1(2)
'Text1(2).Left = 400
'Text1(2).Top = 200
'Text1(2).Visible = True
'And so on...

End Sub

Go Back