array of textboxes

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

i have lists with 10 and more textboxes for example test1.text, test2.text
....i want as i could do in vb6 with just a copy-paste of the same textbox, to
have an array like test(1).text, test(2).text and to change the contents
with a loop like "for"...is there any simple way to solve it?
thank you in advance
 
John,

It is so easy when you know this, however before you know it hard to find.

Dim test As Textbox() = Textbpx() {Textbox1, Textobox2}

:-)

I hope this helps?

Cor
 
John. it easy.

Create either you textboxes in design time or in runtime.
let suppse test1,test2, test3....
assign a tag to each textbox.

in new sub of the form do this:

Dim arrText as new arraylist

add all textboxes and others objects you want into the the array list

arrText.add test1
arrText.add test2.


Now, to use in your application

dim t as textbox
For each Obj in arrText
if typeof(Obj) is TextBox then
t=ctype(Obj,textbox)
if t.tag="1" then
'dosomething
end if
end if
next
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top