StreamReader Class Implements a TextReader that reads characters from a byte stream in a particular encoding. : Stream Reader « File Directory « VB.Net






StreamReader Class Implements a TextReader that reads characters from a byte stream in a particular encoding.

 

Imports System
Imports System.IO

Class Test
    Public Shared Sub Main()
        Try
            Dim 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()
        Catch E As Exception
            ' Let the user know what went wrong.
            Console.WriteLine("The file could not be read:")
            Console.WriteLine(E.Message)
        End Try
    End Sub
End Class

   
  








Related examples in the same category

1.Read all file contentRead all file content
2.Stream Reader DemoStream Reader Demo
3.Stream Reader: read intStream Reader: read int
4.StreamReader Class implements a TextReader that reads characters from a byte stream in a particular encoding.
5.Create StreamReader class for the specified stream.
6.Create StreamReader class for the specified file name.
7.StreamReader.Read reads the next character from the input stream
8.Display Integer read from a StreamReader in hex format