This Visual Basic Tutorial is all about Try Catch.
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 handles errors. Try…Catch statement composed of a Try block and followed by one or more Catch clauses, which stated the handlers for various exceptions.
[ tryStatements ]
[ Exit Try ]
[ Catch [ exception [ As type ] ] [ When expression ]
[ catchStatements ]
[ Exit Try ] ]
[ Catch ... ]
[ finallyStatements ] ]
Catch ex As Exception
MsgBox("The page cannot be loaded because " & vbCrLf & ex.Message)
Readers might read also: