Reputation: 1300
I would like to display my calculated amount with a ,
and the last two decimal places ex. 1000.00
= 1,000.00
. I have tried the coding below, and it works, but It removes my two decimal places when I round it at the end.
lblTotalInclVatAmount.Content = "R " + Math.Round((double + double),2).ToString("N0");
It's sounds simple enough. Any advice would be appreciated, thank you! :)
Upvotes: 2
Views: 1669
Reputation: 8786
The precision specifier indicates the desired number of digits after the decimal point.
As such you are looking for ToString("N2")
instead.
You can see more information from: The Numeric ("N") Format Specifier.
Upvotes: 1