Read text file line by line : Text File Read « Stream File « VB.Net Tutorial






Public Class ReadFromFile

    Shared Sub Main()
    Dim sFileName As String
    Dim srFileReader As System.IO.StreamReader
    Dim sInputLine As String

        sFileName = "test.txt"
        srFileReader = System.IO.File.OpenText(sFileName)
        sInputLine = srFileReader.ReadLine()
        Do Until sInputLine is Nothing
            System.Console.WriteLine(sInputLine)
            sInputLine = srFileReader.ReadLine()
        Loop
    End Sub
End Class








13.20.Text File Read
13.20.1.FileSystem.ReadAllText
13.20.2.Use StreamReader to read text file
13.20.3.Read text file to the file end
13.20.4.Read text file content in Try Catch block
13.20.5.Read text file line by line