944,089 Members | Top Members by Rank

Ad:
  • C# Discussion Thread
  • Unsolved
  • Views: 4350
  • C# RSS
Mar 30th, 2006
0

Error Throwing In Calculator Code When Divided By '0'

Expand Post »
Plzzzzzzzzzzz Can Anyone Help Me Out Of This Problem By Tomorrow....lookin Forward For Any One So Nice To Help Me Up..saman
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
saman is offline Offline
6 posts
since Mar 2006
Mar 30th, 2006
0

Re: Error Throwing In Calculator Code When Divided By '0'

Well, since you can't dive by zero, thats why its thorowing the error... You could just use try catch blocks. Or if you post your code, we could help you with better error handling.

If you use try catch block...

C# Syntax (Toggle Plain Text)
  1. try{
  2. //The calculator main code...Where the error is getting thrown
  3. }
  4. catch
  5. {
  6. MessageBox.Show("You divided by zero...");
  7. //Show the error
  8. }
Team Colleague
Reputation Points: 84
Solved Threads: 99
<Insert title here>
tayspen is offline Offline
1,542 posts
since Jul 2005
Mar 30th, 2006
0

Re: Error Throwing In Calculator Code When Divided By '0'

C# Syntax (Toggle Plain Text)
  1. // generate exception
  2. catch (DivideByZeroException e)
  3. {
  4. // handle exception
  5. }
Reputation Points: 13
Solved Threads: 7
Light Poster
_r0ckbaer is offline Offline
45 posts
since Dec 2005

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C# Forum Timeline: Deleting from database
Next Thread in C# Forum Timeline: image manipulation





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC