However, I'm having a *** of a time getting it to take lines from the text file and put them in the proper text box. Here is an example file:
1 in SHOWNm on SITENAME
where the '' switches the program over to the If/while statement in the code below.
Private Sub OpenProfileToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OpenProfileToolStripMenuItem.Click Dim AllText As String = "" Dim LineOfText As String = "" 'array containing the names of the text boxes I want 'the lines to go into strboxNames(0) = "callNameText" strboxNames(1) = "showNameText" strboxNames(2) = "breedText" strboxNames(3) = "genderText" strboxNames(4) = "showCodeText" strboxNames(5) = "rkcText" strboxNames(6) = "vpaText" strboxNames(7) = "pkcText" strboxNames(8) = "otherText" strboxNames(9) = "totalText" strboxNames(10) = "notesText" OpenFileDialog1.FileName = "Pet.txt" OpenFileDialog1.Filter = "txt (*.txt)|*.txt" OpenFileDialog1.ShowDialog() If OpenFileDialog1.FileName <> "" Then Try FileOpen(1, OpenFileDialog1.FileName, OpenMode.Input) 'ati is the pointer going through the text file Dim ati As Integer = 0 'this reads in the text file into one array Do Until EOF(1) LineOfText = LineInput(1) AllText = AllText + LineOfText + vbCrLf Loop 'splits the array into parts Dim strAllText() As String strAllText = Split(AllText, vbCrLf) 'begin import to the program! i is the pointer for the text boxes For i = LBound(strboxNames) To UBound(strboxNames) 'checks to make sure that we're not in the special Listbox 'section of the text file If strAllText(ati) = "" Then 'moves the pointer up one so it doesn't add the  ati = ati + 1 'as long as it hasn't reached the end of the special case, 'add it to the list box in the GUI While strAllText(ati) <> "" showHistoryList.Items.Add(strAllText(ati)) 'moves to next line ati = ati + 1 End While 'once you're done, move the pointer forward so the program 'doesn't count the second  ati = ati + 1 End If 'THEORETICALLY, this would take the i instance of the 'textbox names defined at the beginning, make it 'into a reference for that textbox, and then place the ati 'instance of strAllText into that text box. Me.Controls(strboxNames(i)).Text() = strAllText(ati) 'moves to next line in the text file ati = ati + 1 Next Finally FileClose(1) End Try End If End Sub
So with the sample file I provided above, in the textbox named callNameText would appear "SHOWNAME", and so on and so forth. If someone has any ideas on how to make this implementation work I'd be eternally grateful! With this build, I get a NullReferenceException on the "Me.Controls(strboxNames(i)).Text() = strAllText(ati)" line.