I am trying to have a textbox set up where multple texboxes are used in teh layout of a table, each one as a seperate box in. (I havn't got the exact size figured out yet but for the sake of testing i've been usieng a layout of 2 rows by 6 coloms.)
I am trying to use an easy methiod in which I can add text into these box by uses variables. For example a layout of textboxes titled like this

    Wall1     Wall2    Wall3   Wall4   Wall5   Wall6 

Using this sort of code:

Dim box As Integer
    Dim wall As String
    Dim num As String
    Do While box < 6
        box = box + 1
        num = box
        wall = "Wall" + num
        Where the variable would become wall1, wall2, wall3 ect.
7 Months
Discussion Span
Last Post by Reverend Jim

Side note: I can also use list boxes if its easier. I just want to know how i can get teh program to indentify a text/list box by using a variable instead of the box name


You can reference a control dynamically by name like

num = 4
dim tbx as TextBox = Me.Controls("TextBox" & num)

Then you can reference the control through the variable. If you want to cycle through a series of TextBoxes just put it in a look like

For i As Int = 1 To 5
    dim tbx as TextBox = Me.Controls("TextBox" & i)
    tbx.Text = ....
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.