Dim a, b, c As Integer
On Error GoTo la
Console.WriteLine("enter a and b")
a = Console.ReadLine()
b = Console.ReadLine()
c = a / b
Console.WriteLine("result" & c)
Console.WriteLine("caught an exception")
Why in the code "caught an exception" gets executed 3 times
unstructured exception handling
Post a Reply
|Oldest Newest Rating|
· December 3, 2015
yes i know we use structured exception handling today it's just i have a viva for my end semester so wanted to know that.
· November 30, 2015
You are trying :
You need an 'Exit Sub' statement before the 'la:' label; otherwise the code underneath is executed one more time after
the statement 'Console.WriteLine("result" & c)' is processed.
Have a look at your Inmediate Window (CTRL-G) for a detail of exceptions generated by your code.
BTW 'On Error Goto (Label)' and 'RESUME NEXT' is fairly old style coding practice, going back to Microsoft GWBASIC in MS-DOS and CP/M. I would say the code is deprecated nowadays. You might have a look at try...catch instead.
· November 29, 2015
One of the first products to provide a graphical environment and a paint metaphor for developing user interfaces.
|Bucky Roberts Administrator|