Imports System.IO
Module Module1
Sub Main()
Dim TextFile As StreamReader
Try
TextFile = New StreamReader("test.txt")
Catch E As Exception
Console.WriteLine("Error opening the file test.txt")
Console.WriteLine("Error {0}", E.Message)
End Try
Dim Content As String
Try
Content = TextFile.ReadToEnd()
Console.WriteLine(Content)
Catch E As Exception
Console.WriteLine("Error reading file")
Console.WriteLine("Error {0}: ", E.Message)
End Try
TextFile.Close()
End Sub
End Module
|