vbnet Read one line from a file
Using System.IO Dim line As String 'Create new StreamReader instance with Using block Using reader As StreamReader = New StreamReader("file.txt") line = reader.ReadLine End Using 'Write the line we read from "file.txt" Console.WriteLine(line) 'alternatively, read each line into a List: Dim list As New List(Of String) Using r As StreamReader = New StreamReader("file.txt") Dim line As String line = r.ReadLine Do While (Not line Is Nothing) list.Add(line) Console.WriteLine(line) line = r.ReadLine Loop End Using
Reads one line from a file and each line into a List - could be adapted to ReadToEnd()
Updated: Saturday 9th October 2010, 07:23pm
There are 0 comments
Comments are currently closed.