1 / 10

Try-Catch Blocks

Try-Catch Blocks. Exception Handling. The Try-Catch set of statements detects exceptions and takes corrective action. Exception Handling. Exception Handling. Additional Information.

aida
Download Presentation

Try-Catch Blocks

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Try-Catch Blocks

  2. Exception Handling • The Try-Catch set of statements detects exceptions and takes corrective action

  3. Exception Handling

  4. ExceptionHandling

  5. Additional Information • When using multiple Catch blocks, you should always put the most common exception as the first Catch block, followed by the next likely exception, etc. • The Finally statement is optional and executes last regardless of whether the code in the Catch blocks has been executed.

  6. Exception Handling

  7. Knowledge Check • Which type of exception would be detected if you use the conversion command Convert.ToInt32 to convert a non-integer value? • * • FormatException

  8. Knowledge Check • Which type of exception would be detected in the following code: Dim intMultiple as Integer Dim intProduct as Integer intMultiple = 2000000000 intProduct = intMultiple ^ 10 * • OverflowException

  9. Check for Knowledge • If you use multiple Catch blocks in a Try-Catch block of code, how do you determine the order of the Catch blocks?

  10. Last ? • Where should the optional Finally block be placed in the Try-Catch block? • After the Try • After the Catch • Before the End Try

More Related