Hi. I'm trying to read a text file that contains info like this:
ACX-101-011 , J2168
BTXR-130A-013, D6733
AJ4-233-614, T8211
I want to split each line at the comma and write the left side to a textbox and the the right side to another textbox. I'm close, with the code below, but I can only post results from the first line in the file. How do I loop this and append the text results in each of the textboxes. I am admittedly a VB.NET.NOOB, and I'm pulling my hair out! Any help would be great. Thanks.
ACX-101-011 , J2168
BTXR-130A-013, D6733
AJ4-233-614, T8211
I want to split each line at the comma and write the left side to a textbox and the the right side to another textbox. I'm close, with the code below, but I can only post results from the first line in the file. How do I loop this and append the text results in each of the textboxes. I am admittedly a VB.NET.NOOB, and I'm pulling my hair out! Any help would be great. Thanks.
VB.NET:
Dim TempFile As String
TempFile = "temp.txt"
Dim sw As StreamWriter
If File.Exists(TempFile) = False Then
sw = File.CreateText(TempFile)
sw.Flush()
sw.Close()
End If
sw = File.AppendText(TempFile)
sw.WriteLine(TextBox4.Text)
sw.Flush()
sw.Close()
Dim reader As New StreamReader(TempFile)
Dim data As String()
data = reader.ReadLine().Split(",")
TextBox1.Text = Trim(data(0))
TextBox2.Text = Trim(data(1))
reader.Close()