Click to See Complete Forum and Search --> : Why doesn't this fail?


John G Duffy
March 27th, 2002, 03:38 PM
I have a new toy called VS.Net and am learning from a Book. This book hs me create a caoculator program demoing among other things the "Try" "Catch" "FInally" and "End Try" sequence to intercept errors.
In a standalone example Windows Application program the Divide by 0 statement fails and the exception is caught and the error Message is printed, but in their calculator program it does not.
I trace past the statement that is supposed to fail (Result = Operand2 / 0 ) supposedly a divide by 0 failure, and the Autos window shows result as 1.#inf.
There must be a error switch set somewhere but I have no clue as to where. Can anyone shed any light?

private Sub bttnClick(.........)
Dim Result as Double
dim Operand2 as double
Try
Result = Operand2 / 0
Catch exc as Exception
msgbox(exc.Message)
Finally
clearDisplay = true
End Try




'
'
Please rate it if it answers the question
or is useful.
'
John G

Iouri
March 28th, 2002, 10:54 AM
VB.NET can handle the division by 0. It produces the result string "Infinity"

Iouri Boutchkine
iouri@hotsheet.com

John G Duffy
March 28th, 2002, 11:13 AM
Thanks, Live and learn

'
'
Please rate it if it answers the question
or is useful.
'
John G