本文整理匯總了VB.NET中System.DivideByZeroException類的典型用法代碼示例。如果您正苦於以下問題:VB.NET DivideByZeroException類的具體用法?VB.NET DivideByZeroException怎麽用?VB.NET DivideByZeroException使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了DivideByZeroException類的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的VB.NET代碼示例。
示例1: Example
Module Example
Public Sub Main()
Dim number1 As Integer = 3000
Dim number2 As Integer = 0
Try
Console.WriteLine(number1\number2)
Catch e As DivideByZeroException
Console.WriteLine("Division of {0} by zero.", number1)
End Try
End Sub
End Module
輸出:
Division of 3000 by zero.
示例2: Main
Module Example
Public Sub Main()
Dim number1 As Integer = 3000
Dim number2 As Integer = 0
Console.WriteLine(number1/number2)
End Sub
End Module
輸出:
Infinity