How to VB.NET TextReader operations

Textreader and TextWriter are the another way to read and write file respectively, even though these are not stream classes. The StreamReader and StreamWriter classes are derived from TextReader and TextWriter classes respectively.

Imports System.IO
Public Class Form1
    Private Sub Button1_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Button1.Click
            Dim line As String
            Dim readFile As System.IO.TextReader = New _
            While True
                line = readFile.ReadLine()
                If line Is Nothing Then
                    Exit While
                End If
            End While
            readFile = Nothing
        Catch ex As IOException
        End Try
    End Sub
End Class

When you execute this program the TextReader read the file line by line. (C) 2021    Founded by raps mk
All Rights Reserved. All other trademarks are property of their respective owners.
SiteMap  | Terms  | About