DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/index.php)
-   C# (http://www.daniweb.com/forums/forum61.html)
-   -   Error Throwing In Calculator Code When Divided By '0' (http://www.daniweb.com/forums/thread42246.html)

saman Mar 30th, 2006 3:26 am
Error Throwing In Calculator Code When Divided By '0'
 
Plzzzzzzzzzzz Can Anyone Help Me Out Of This Problem By Tomorrow....lookin Forward For Any One So Nice To Help Me Up..saman

tayspen Mar 30th, 2006 11:24 am
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...

try{
//The calculator main code...Where the error is getting thrown
}
catch
{
MessageBox.Show("You divided by zero...");
//Show the error
}

_r0ckbaer Mar 30th, 2006 6:08 pm
Re: Error Throwing In Calculator Code When Divided By '0'
 
// generate exception
catch (DivideByZeroException e)
{
  // handle exception
}


All times are GMT -4. The time now is 3:30 am.

Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC