Dynamically allocated arrays -> newbie
Hi all. I'm just starting to learn VB.NET and I have a problem. I'm trying to read in a text file, parse it, and display the results. Here is an example of what my text files might look like:
Code:
ABC Field1Field2Field3Field4
BCD Field1Field2Field3Field4Field5Field6
CDE Field1Field2Field3Field4Field5
XYZ Field1Field2Field3Field4Field5Field6...
TUV Field1Field2Field3Field4Field5Field6...
XXX Field1Field2Field3Field4Field5Field6...
...
Basically there is a header before each line that is a set length. Based on the header, I know how many fields there are and how long each field is (there is no common field length, that is Field1 could be 10 characters and Field2 could be 3 characters and Field1 of another line could be 25 characters). I could have as few as five lines and as many as 100 or more.
My problem is displaying the results. My plan is to read the lines in and display them to seperate tab pages (line ABC would go to the first tab page, BCD would go to the next, etc.). Generating the controls is no big deal. I can figure that out myself. I am trying to get each field its own TextBox. The only way I know how to do it is like:
Code:
Dim txtBox() As TextBox = {TextBox1, TextBox2, ... TextBoxN}
Dim index As Integer
Do
InputString = InputFile.GetLine()
tmpString = Mid(InputString, StrngIndex, Length
txtBox(index).Text = tmpString
Loop While Not InputString Is Nothing
Or something like that. That's not quite right, but the point is that as I read in the line, I need to make enough TextBoxes to hold each field. Also, as I populate pages, the TextBox index will not start at one. For instance on the third page, they may start at 20 or something.
Is this at all clear? Is there any hope? Is there a better way to do it?
Thanks