I have 36 string names that I'd like to create. In general these string names can be very similar. I thought I'd try creating a loop to do this for me. But I can seem to find the correct syntax to do this. To clarify, these string names can be as simple as
and so forth and so on.
I tried doing the following:
For i As Integer = 1 To 36 Dim line As String = Me.ToString("line" & i) Dim txt As TextBox = Me.Controls("txbUserFld" & i) Using reader As StreamReader = New StreamReader("c:\BusinessBasics\miscspareflds.txt") line = reader.ReadLine End Using txt.Text = line Next
So you understand, StreamReader is reading a .txt file that has 36 names in it. I want to display these 36 names in 36 separate TextBoxes (TextBox1 thru TextBox36). To do this I need 36 separate string names (line1 thru line36). Obviously, I can write "Dim line1 As String" thru "Dim line36 As String" and "TextBox1.Text = line1" thru "TextBox36.Text = line36". But I've got to believe there is an easier way using a loop to do this.