The way we used to do it with VB 6.0 and under was like this:
On Error Goto ErrorTrap1:
i = i / 0
Exit Sub
ErrorTrap1:
Msgbox "Got an error! " & Err.Description
Or
On Error Resume Next
Err.Clear
i = i / 0
If err.Number > 0 Then
Msgbox "Got an error! " & Err.Description
End If
In VB.NET error trapping will have to be re-written! Joy!
Try
i = i / 0
Catch e as Exception
Messagebox.Show("Got an error! " & e.Message)
End Try
The "Try" statement, get used to it!
Try
(Try_Statements)
[Catch [(variable) [As (type)]][When (expression)]
(catch_statements>]
[Catch [(variable) [As (type)]][When (expression)]
(catch_statements)]
...
[Finally
(finally_statements)]
End Try
It looks like the "Finally" part is optional, but can be used to close files, close database connections, empty objects, etc. This is the cleanup part.
You can apparently have multiple catch parts, these appear to be the error handling routines or the error message routines.
Learned something new today. :)