Pages

Search This Blog

Exception Handling Example


Module ExecptionHandlingExample
 
    Sub Main()
        Dim a, b, c As Integer
        Console.Write("Enter a and b :")
        a = CInt(Console.ReadLine)
        b = CInt(Console.ReadLine)
        Console.WriteLine("a = " + a.ToString())
        Console.WriteLine("b = " + b.ToString())
        Console.WriteLine()
        Try
            c = a \ b
            Console.WriteLine("c = " + c.ToString())
        Catch ex As Exception
            Console.WriteLine("Exception occured: " + ex.Message())
        End Try
        Console.ReadLine()
    End Sub
 
End Module


1 comment: