Module ExceptionVB

    Function TestError()
        Err.Raise(vbObjectError, "TestWidth", _
                  "To jest testowy komunikat o błędzie.")
    End Function

    Sub Main()
        Dim a As Integer
        Dim b As Integer
        Dim c As Integer
        a = 1
        b = 0
        Try
            ' Dzielenie liczb całkowitych
            c = a \ b
        Catch ex As Exception
            Console.WriteLine(ex.Message)
        End Try
        Try
            TestError()
        Catch ex As Exception
            Console.WriteLine(ex.Message)
        End Try
    End Sub

End Module
