Read Text from a File : Text File Read « File Directory « VB.Net






Read Text from a File

 
Imports System
Imports System.IO

Class Test
    Public Shared Sub Main()
        Try
            Using sr As StreamReader = New StreamReader("TestFile.txt")
                Dim line As String
                Do
                    line = sr.ReadLine()
                    Console.WriteLine(Line)
                Loop Until line Is Nothing
                sr.Close()
            End Using
        Catch E As Exception
            Console.WriteLine(E.Message)
        End Try
    End Sub
End Class

   
  








Related examples in the same category

1.Read Text File ContentRead Text File Content
2.Open Text file and count the lines
3.Read Text File in a single StatementRead Text File in a single Statement
4.Text File content outputText File content output
5.Read and Write Files
6.Read Text from a File
7.Read lines from a text file
8.Open text file to read
9.Read line by line from a text file
10.Read Text from a File with DO Until