Mega Code Archive

 
Categories / VB.Net / File Directory
 

Read Text from a File with DO Until

Imports System Imports System.IO Class Test     Public Shared Sub Main()         Try             Using sr As StreamReader = New StreamReader("TestFile.txt")                 Dim line As String                 Do                     line = sr.ReadLine()                     Console.WriteLine(Line)                 Loop Until line Is Nothing             End Using         Catch E As Exception             Console.WriteLine("The file could not be read:")             Console.WriteLine(E.Message)         End Try     End Sub End Class