Re: Exceptions are not raised
- From: "Kevin Spencer" <kevin@xxxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Wed, 5 Apr 2006 08:01:04 -0400
Exceptions certainly *are* raised when they occur. However, in this case,
you're expecting a "divide by zero" exception, but it will not occur,
because in the .Net Platform, dividing by zero is not an illegal operation.
It results in "infinity."
--
HTH,
Kevin Spencer
Microsoft MVP
Professional Numbskull
Show me your certification without works,
and I'll show my certification
*by* my works.
"Giuseppe Chielli" <giuchiel@xxxxxxxxxxxxxxx> wrote in message
news:mMLYf.65484$PR2.1103327@xxxxxxxxxxxxxxxxxxxxx
Hi to everyone. I am studying VB.net and I am wondering why this trivial
code doesn't raise any exception:
Option Strict On
Imports System
Imports Microsoft.VisualBasic
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim num1, num2 As Short
Dim num3 As Double
num1 = 5
num2 = 0
Try
num3 = num1 / num2
Catch ex As DivideByZeroException
MsgBox("Divisione per 0!")
End Try
End Sub
End Class
No msgbox is executed!!!
I'm using VB 2005 Express Edition.
Should I set anything in the framework or project properties?
Thanks in advance to everyone.
Giuseppe from Italy.
.
- References:
- Exceptions are not raised
- From: Giuseppe Chielli
- Exceptions are not raised
- Prev by Date: Re: inheritance
- Next by Date: Re: Visual C# 2K5 Express Edition cannot work properly
- Previous by thread: Exceptions are not raised
- Next by thread: Re: Exceptions are not raised
- Index(es):
Relevant Pages
|