-
I am a new VB programmer and I would like to know:
How do you add components onto the form during runtime?
For example:
You start of with a form with just a command button.
You click the button and it creates a new text box on the form. You click the button again and it generates another text box. How can I do this without having to create lots of invisible text boxes first. I want to be able to create as many text boxes as I want.
Thanx
-
Use a Control array
If you just make one invisible textbox and set it's index property to 0
You can then create as many as you like by using the commandline
to create the first one, then
to make the second one etc
They'll all be invisible and in the same position as the first text box when you first create them, so remember to make them visible and move them.
You can get rid of them with
Which gets rid of the first one you created (text1(2) will still be there)