How can i create list of textboxes in vb2012 to be like textbox(0).text textbox(1).text

Dim textbox As New ArrayList

Dim textbox As New ArrayList

Yes but i want when i'm adding a textbox object on form to be a textbox(0). something like in vb6 i just add one textbox on form and copy/paste it so i get textbox(0) textbox(1) textbox(2) ... Because it is very easy to use it in for loops

        For i = 0 To 5
            Dim textbox As New TextBox
            textbox.Name = "Textbox(" & i & ")"
            Me.Controls.Add(textbox)
        Next

but the textboxes will be created on top of each other so add the location inside the loop

textboxe.Location = New Point(X,Y)

Good Luck

And if you want to attach event handlers to the textboxes just do

AddHandler <event>, AddressOf <subname>

as in

AddHandler TextBox1_TextChanged, AddressOf MyHandlerSub
.
.
.
Private Sub MyHandlerSub(sender As System.Object, e As System.EventArgs)

You can assign the same handler to all of the textboxes. Just make sure you can tell which one triggered the event by assigning unique names or setting an appropriate value for the Tag property.

Just

You can assign the same handler to all of the textboxes. Just make sure you can tell which one triggered the event by assigning unique names or setting an appropriate value for the Tag property.

You can assign the same handler to all of the textboxes. Just make sure you can tell which one triggered the event by assigning unique names or setting an appropriate value for the Tag property.

You guys don't undestand me what i want.
In visual basic 6.0 i select textbox and put on form his default name is textbox1 when i copy/paste that textbox i got textbox1(0) paste again textbox1(1) ..

How to do that on visual basic 2012 ? ...
I don't want to add it in code i just want to put those objects on form. Sorry on my bad english but im trying to explain the better i can.

You can't, you have to rename them!

@oussama 1: your code is a bit incorrect.
I would have corrected it, but found a good post here on this site, with an answer of the Reverend himself!

If you are adding multiple textboxes at design time then the IDE will assign sequential names by default whether you drag and drop or copy/paste.

@ddanbe my code is missing the details that's all.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.