Question Loop set text to textboxes

Muchni

Member
Joined
Sep 30, 2008
Messages
18
Programming Experience
1-3
Is it a way to set the text in a textbox from a loop? Bad Explained, heres an example
VB.NET:
    Dim id(10) as string
  For h As Integer = 0 To 10
            id(h) = "hello" & h



        Next

there will all 11 variables change, but I have a program that creates textboxes with the same name except for the last char that is a integer variable.

VB.NET:
dim id(50) as string
dim idv(50) as integer
 For h As Integer = 0 To 20
            id(h) = namn(h).Text 'error on the textbox
            idv(h) = coin(h).Text 'error on the textbox


        Next
This doest work

If anyone understands my problem, plz help me out, I need to convert the value in many many textboxes to variables so I rly just cant type every line
 
hi i have a similar problem

i have a form called users with a number of textboxes on and i used this code

VB.NET:
For i = 1 To 7
  loading(i) = users.Controls("TextBox" & i).Text

next

i am using this code on my main form to access the info on the users form but it doesnt work

the example code on this thread works fine on the users form for a different purpose but when using it on my main form it doesnt work.. any ideas?

EDIT: Sorted it out now i forgot to declare the form
 
Last edited:

Latest posts

Back
Top