VB.Net by API/System/FormatException

Материал из VB Эксперт
Перейти к: навигация, поиск

FormatException.Message

  
 
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