Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


Error  Handler

Posted on 2004-11-29
Medium Priority
Last Modified: 2010-04-24
How would you handle:
99999 +99999 = 'System.OverflowException'
' 9 divide 0' = infinity
99 * 999 = 'System.OverflowException'
32000 - -768 = you will get an exception
Question by:Barako2
1 Comment

Accepted Solution

Lacutah earned 1050 total points
ID: 12701066
You decide how to handle each of those errors using "Try...Catch" blocks:

dim i as int16
     i = 99999 +99999
catch ex as System.OverflowException
     'Inside the Catch Block, you put code that you want to execute if something goes wrong.  Here, we're capturing only an OverflowException.
     i = nothing
     messagebox.Show("Sorry, I can't add that hight.")
catch genEx as System.Exception
     'Here, I'm catching any other exceptions that may have occured other than the OverflowException
      i = nothing
      messagebox.show("An error occurred." & vbCrLf & genEx.message)
end Try

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction When many people think of the WebBrowser (http://msdn.microsoft.com/en-us/library/2te2y1x6%28v=VS.85%29.aspx) control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
Loops Section Overview
Screencast - Getting to Know the Pipeline
Suggested Courses
Course of the Month14 days, 12 hours left to enroll

578 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question