One way
Dim data As String
Using sr As New StreamReader("C:\test.txt")
Do
data = sr.ReadLine()
If Not data Is Nothing Then
' do some parsing
End If
Console.WriteLine(data)
Loop Until data Is Nothing
End Using
2nd way - READ it ALL
Imports System Imports System.IO Class ReadALLFile Public Shared Sub Main() Try Using sr As New StreamReader("TestFile.txt") Dim line As String line = sr.ReadToEnd() Console.WriteLine(line) End Using Catch e As Exception Console.WriteLine(e.Message) End Try End Sub End Class
No comments:
Post a Comment