HELP!
i want to read two text file at the same time, i could read a text file line by line but when i added 1 text file to read at the same time it only read the first line and nothing more..
for example:
in name.txt it has
and in age.txt it has
i want to read them simultaneously so that i could save them into the database with their corresponding name and age..
here is my code:
Public Sub ReadName()
On Error Resume Next
Dim FileReader As System.IO.StreamReader
FileReader = My.Computer.FileSystem.OpenTextFileReader(des & "\name.txt")
Dim stringReader As String
stringReader = FileReader.ReadLine
txtName.Text = stringReader
FileReader.Close()
End Sub
and same code for the age
Public Sub ReadAge()
On Error Resume Next
Dim FileReader As System.IO.StreamReader
FileReader = My.Computer.FileSystem.OpenTextFileReader(des & "\age.txt")
Dim stringReader As String
stringReader = FileReader.ReadLine
txtAge.Text = stringReader
FileReader.Close()
End Sub
i've tried the code that γηράσκω δ' αεί πολλά διδασκόμε provided but the only value that would display in the textbox is the last one.. i just want to display it on the textbox everytime it reads each line.. i put it in the timer and when the form loads the timer will be enabled..
Dim FileReaderName, FileReaderAge As System.IO.StreamReader
FileReaderName = My.Computer.FileSystem.OpenTextFileReader("C:\Users\toshiba\Desktop\from sky\name.txt")
FileReaderAge = My.Computer.FileSystem.OpenTextFileReader("C:\Users\toshiba\Desktop\from sky\age.txt")
Dim nameReader, ageReader As String
Do While FileReaderName.Peek() >= 0 And FileReaderAge.Peek() >= 0
nameReader = FileReaderName.ReadLine
ageReader = FileReaderAge.ReadLine
TextBox1.Text = nameReader
TextBox2.Text = ageReader
Loop
FileReaderName.Close()
FileReaderAge.Close()