Click to See Complete Forum and Search --> : dynamically adding/removing controls


help chris
October 12th, 1999, 10:03 AM
hi,

Is it possible (I'm sure it is, just no clue how to) to add/remove a control (in this case a textbox) to a control arrary durring runtime? Basically I just want the user to be able to add a new text box in to a form.

thanks

Lothar Haensler
October 12th, 1999, 10:21 AM
yes, it is. You create your initial textbox on your form and give it an Index property of 0,
then in the event handler for adding a new control, code like this.
load text1(1)
text(1).visible = true ' important!
then position the textbox somewhere:
text1.move...

or use VB 6's new Add method of the Controls collection.