In programming, there are Exceptions that handle errors and other exceptional events. As a programmer, it is the best way to used it to deal with unhandled exceptions. In Visual Basic, there is a try catch that handle errors. Try…Catch statement composed of a Try block and followed by one or more Catch clauses, which stated the handlers for various exceptions.
Try [ tryStatements ] [ Exit Try ] [ Catch [ exception [ As type ] ] [ When expression ] [ catchStatements ] [ Exit Try ] ] [ Catch ... ] [ Finally [ finallyStatements ] ] End Try
- Catch ex As Exception
- MsgBox("The page cannot be loaded because " & vbCrLf & ex.Message)
- End Try