VB.Net by API/System/DivideByZeroException — различия между версиями

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

Текущая версия на 12:51, 26 мая 2010

DivideByZeroException.Message

  
 
Imports System.IO
public class Tester
   public Shared Sub Main
        Dim y As Integer
        Dim x As Integer
        Dim z As Integer
        Try
            x = 1
            y = 0
            z = x / y
        Catch e As DivideByZeroException
            Console.WriteLine("You have attempted to divide by zero!")
            y = 2
            z = x / y
        Catch e As OverflowException
            Console.WriteLine("You have encountered an overflow exception. ")
            y = 2
            z = x / y
        Catch e As System.Data.ConstraintException
            Console.WriteLine("You have encountered a constraint exception. ")
            y = 2
            z = x / y
        Finally
            Console.WriteLine(x & "/" & y & " = " & z)
        End Try
   End Sub
   
End class