Kamis, 31 Juli 2025

VB DemoOnErrorGoto

 Module DemoOnErrorGoto

    'Buka DemoOnErrorGoto.vbproj

    Sub Main()

        On Error GoTo ErrorHandler

        Dim a, b, c

        'Inisialisasi variabel

        a = 1 : b = "Satu"

        c = a + b

        Debug.Print("Nilai a + b = " & c)

        Exit Sub

ErrorHandler:

        MsgBox("Salah - Type Mismatch")

        Resume Next

    End Sub


End Module


Tidak ada komentar: