_____________________________________________
Exception Handling in VB.
_____________________________________________
' Throw an exception
Dim ex As New Exception("Something is really wrong.")
Throw ex
' Catch an exception
Try
y = 0
x = 10 / y
Catch ex As Exception When y = 0 ' Argument and When is optional
Console.WriteLine(ex.Message)
Finally
Beep()
End Try
On Error GoTo MyErrorHandler
...
MyErrorHandler: Console.WriteLine(Err.Description)
____________________________________________________________________
____________________________________________________________________
No comments:
Post a Comment