Exception Handling Form Solved

30.00 $

Click Category Button to View Your Next Assignment | Homework

You'll get a download link with a: . zip solution files instantly, after Payment


5/5 - (1 vote)

Design a form that mimics the following pattern:

First, write some functionality into the form class that allows basic addition to be performed.  The user provides two addends and when the AddThem() button is pressed, the result is placed in the third text box.

For example….

Notice, that if you type invalid input in the two boxes on the left, the program will throw an exception!

Design exception handling code in your class that prevents the program from crashing.  If the user types input that does not contain any digits, assume a value of zero.  However, if the use types in a mix of digits and non-digits, the program should clean out all of the non-digits and work with the number that is left behind.  Consider the following examples to clarify what you are supposed to be doing…

You will need to make use of string manipulation functions to accomplish this.  Use the exception handling mechanism to handle the System.InvalidCastException object that gets thrown when the user types something in the box that cannot be easily converted to an integer representation.  You may assume that all things being added in this program are integers, so treat the decimal point an just another problem character.

  • Exception-Handling-Form-Solution.zip