On Error GoTo errorhandle : On Error GoTo « Statements « VB.Net Tutorial






Imports System.IO

public class Tester
   public Shared Sub Main

        Dim myfile As System.IO.File
        Dim w As System.IO.StreamWriter
        On Error GoTo errorhandle

        w = myfile.AppendText("a:\temp.txt")
        w.Write("a")
        w.Close()
        Exit Sub

        errorhandle:
        Console.WriteLine("Please Insert")
        Exit Sub
        Resume
   End Sub
   
End class
Please Insert








4.18.On Error GoTo
4.18.1.On Error GoTo errorhandle
4.18.2.Select Case Err.Number