Basics of Visual Basic exception handling : Exception « Development « VB.Net Tutorial
- VB.Net Tutorial
- Development
- Exception
Public Class Tester
Public Shared Sub Main
Try
Dim numerator As Integer = Convert.ToInt32("123")
Dim denominator As Integer = Convert.ToInt32("321")
Dim result As Integer = numerator \ denominator
Console.WriteLine(result)
Catch formattingException As FormatException
Console.WriteLine("You must enter two integers")
Catch dividingException As DivideByZeroException
Console.WriteLine(dividingException.Message)
End Try
End Sub
End Class
0