Mega Code Archive

 
Categories / VB.Net Tutorial / Development
 

Catch EndOfStreamException

Imports System.IO public class Tester    public Shared Sub Main         Dim Stream As IO.StreamReader = IO.File.OpenText("test.txt")         Try             Console.WriteLine(Stream.ReadLine())         Catch e As EndOfStreamException             Console.WriteLine("EndOfStreamException")         Catch e As IOException             Console.WriteLine(e.Message)         Finally             Stream.Close()         End Try    End Sub     End class