Mega Code Archive

 
Categories / VB.Net Tutorial / Development
 

Catch Exception in a function

Module Module1     Sub Main()             Try                 AddNumbers(1, 2)             Catch Except As Exception                 Console.WriteLine("Call generated error: " & Except.Message)             End Try     End Sub     Function AddNumbers(ByVal A As Integer, ByVal B As Integer) As Integer         Try             Throw New ArithmeticException()         Catch Except As Exception             Console.WriteLine(Except.Message)         End Try     End Function End Module Overflow or underflow in the arithmetic operation.