Vb.Net-Informations.com

  How to VB.NET TextReader operations




   Categories

    HOME
    VB.NET
    CSHARP

 
   














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.


         VB.NET Source Code Download           Print Source Code
         How to VB.NET TextReader operations - Download
        
VB.Net Tutorial

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

When you execute this program the TextReader read the file line by line.

VB.NET Files Related Contents
*     How to VB.NET Directory operations
*     How to VB.NET File operations
*     How to VB.NET FileStream
*     How to VB.NET Simple TextReader
*     How to VB.NET TextWriter
*     How to VB.NET BinaryReader
*     How to VB.NET BinaryWriter

VB.Net Related Topics
*     Microsoft .Net Framework Tutorials
*     VB.NET Language Basics Tutorials
*     VB.NET Program Flow Control Tutorials
*     VB.NET Collections Tutorials
*     VB.NET String Tutorials
*     VB.NET Files Tutorials
*     VB.NET Excel 2007 Tutorials
*     VB.NET Crystal Reports Tutorials
*     VB.NET Communications Tutorial
*     VB.NET ADO.NET Tutorial with source code
*     ADO.NET Data Providers help and Tutorial
*     VB.NET ADO.NET Dataset Tutorial
*     ADO.NET DataAdapter and Dataset
*     VB.NET ADO.NET DataView Tutorial
*     VB.NET Remoting Tutorial
*     VB.NET XML Tutorial
Search here for more CSharp Source Code :

  |  Home   |  SiteMap   |  About   |
net-informations.com (C) 2010 All Rights Reserved