StreamReader.ReadLine Method reads a line of characters from the current stream : Stream Writer « File Directory « VB.Net

Home
VB.Net
1.2D
2.Application
3.Class
4.Data Structure
5.Data Types
6.Database ADO.net
7.Date Time
8.Development
9.Event
10.File Directory
11.Generics
12.GUI
13.Internationalization I18N
14.Language Basics
15.LINQ
16.Network Remote
17.Reflection
18.Security
19.Thread
20.Windows Presentation Foundation
21.Windows System
22.XML
23.XML LINQ
VB.Net Tutorial
VB.Net by API
VB.Net » File Directory » Stream WriterScreenshots 
StreamReader.ReadLine Method reads a line of characters from the current stream
 

Imports System
Imports System.IO
Imports System.Text

Public Class Test

    Public Shared Sub Main()
        Dim path As String = "c:\temp\MyTest.txt"
        Try
            Dim sw As StreamWriter = New StreamWriter(path)
            sw.WriteLine("This")
            sw.WriteLine("is ")
            sw.WriteLine("a")
            sw.WriteLine("test")
            sw.Close()

            Dim sr As StreamReader = New StreamReader(path)

            Do While sr.Peek() >= 0
                Console.WriteLine(sr.ReadLine())
            Loop
            sr.Close()
        Catch As Exception
            Console.WriteLine("The process failed: {0}", e.ToString())
        End Try
    End Sub
End Class

   
  
Related examples in the same category
1.StreamWriter WriteLine
2.StreamWriter Implements a TextWriter for writing characters to a stream in a particular encoding.
3.StreamWriter.Write (Char[], Int32, Int32) writes a subarray of characters to the stream.
4.Cookie class is used to manage cookies
5.Cookie.Comment Property gets or sets a comment that the server can add to a Cookie.
6.StreamReader.CurrentEncoding Property gets character encoding
7.StreamReader.Peek Method Returns the next available character but does not consume it.
8.StreamReader.ReadToEnd reads stream from the current position to the end
9.Create StreamWriter from file name string
10.Create StreamWriter from FileStream
11.Create StreamWriter from FileStream and default encoding
12.New StreamWriter("FileName", True)
13.Create FileStream from file name string
14.Create StreamWriter with Encoding UTF8
15.Create StreamWriter with Encoding UTF8 and buffer size
16.Writes a subarray of characters to the stream with StreamWriter
17.Creates a StreamWriter and write text to it
18.Flush data to StreamWriter
19.Write Unicode char with StreamWriter
20.StreamWriter Class Implements a TextWriter for writing characters to a stream in a particular encoding.
21.File.AppendText Method Creates a StreamWriter and appends UTF-8 encoded text to the file.
22.Use StreamWriter to write text to a file
w__w__w__.j_av___a2___s_.___co__m___ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.