Israel

Israel

  • NA
  • 1.3k
  • 204.3k

How to keep any decimal number after aritmetic operations

Aug 24 2018 4:21 PM
Hi,
 
I have a serious problem. I do make any aritmetic operations and it's work very well. But the problem is on any aritmetic operations for example 135,54 + 18,55 =  154,09
 
txtNumber1 = 135,54
txtNumber2 = 18,35
txtResNumber = 154,89
 
Now in practice:
 
double d1, d2, total;
double.TryParse(txtNumber1.Text, out d1);
double.TryParse(txtNumber2.Text, out d2);
total = d1 + d2;
txtResNumber.Text = total.ToString("N2");
 
Then the result show every time 154,00 never show the real result as 154,89
I need a good solution to resolv it please.
 
Thank you,
Israel. 
 
 

Answers (5)