Click here to Skip to main content
15,921,779 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am using a label that displays dollar(currency) value on a form (Not part of a FormView). Please assist to display the currency value to two decimal places.

lblSumInsured.Text = dsApplication.ApplicationRegister[0].SumInsured.ToString();

for the date ....

lblEndDate.Text = dsApplication.ApplicationRegister[0].EndPeriod.ToString("MMMM d, yyyy");
Posted
Updated 29-Jan-13 17:40pm
v2

You just need to use format string - see http://msdn.microsoft.com/en-us/library/0c899ak8.aspx[^] for examples.
 
Share this answer
 
For currency

C#
lblSumInsured.Text = string.Format("{0:C}", dsApplication.ApplicationRegister[0].SumInsured);
 
Share this answer
 
For Currency

lblSumInsured.Text = decimal.Parse(dsApplication.ApplicationRegister[0].SumInsured.ToString()).ToString("c");
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900