Hi, I have the following code that reads a text file into an array and then displays it into a textbox. The contents of my text file are :
General
Hey,There
My question is how can I get streamreader to ignore the first line of the file (General) and just read the second line of the file (Hey,There) because I do not need to display "General" in my textbox but I have to keep the text file in this format.
Private Sub btnLoad_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLoad.Click
Dim sr As New IO.StreamReader(txtLoadPath.Text)
Dim tempArray()
While Not sr.EndOfStream
tempArray = Split(sr.ReadLine, ",")
txtPath.Text = (tempArray(0))
End While
sr.Close()
End Sub
General
Hey,There
My question is how can I get streamreader to ignore the first line of the file (General) and just read the second line of the file (Hey,There) because I do not need to display "General" in my textbox but I have to keep the text file in this format.
Private Sub btnLoad_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLoad.Click
Dim sr As New IO.StreamReader(txtLoadPath.Text)
Dim tempArray()
While Not sr.EndOfStream
tempArray = Split(sr.ReadLine, ",")
txtPath.Text = (tempArray(0))
End While
sr.Close()
End Sub