For class, I made a program that lists various items along with a cost. Next to the items are text boxes for quantity of the item. When I click a button it provides a total price.
For the most part, my program works, but I need it to display 1.30 instead of 1.305847.
If I need to post my code I will.
Need output to be 2 decimal positions.
Page 1 of 12 Replies - 171 Views - Last Post: 28 September 2012 - 06:25 PM
Replies To: Need output to be 2 decimal positions.
#2
Re: Need output to be 2 decimal positions.
Posted 28 September 2012 - 06:22 PM
The .ToString method can take parameters
You can for example take an Double of 1.305847 and override it with .ToString("N2") you will get 1.31 in the result.
You can for example take an Double of 1.305847 and override it with .ToString("N2") you will get 1.31 in the result.
This post has been edited by CharlieMay: 28 September 2012 - 06:22 PM
#3
Re: Need output to be 2 decimal positions.
Posted 28 September 2012 - 06:25 PM
Page 1 of 1
|
|

New Topic/Question
Reply



MultiQuote





|