Because you should NEVER use
Convert.ToDouble
on a user-specified value coming from a
TextBox
. Use
Double.TryParse()
instead:
double value1;
if (Double.TryParse(textBox1.Text, out value1))
{
}
Beyond that, if I were you, I'd use a
decimal
type instead of a
double
because you get MUCH better and predictable precision when you're doing math with a
decimal
value.