Convert integer to two decimal places using C#

Last Reply on Nov 25, 2016 01:54 AM By dharmendr

Posted on Nov 25, 2016 01:53 AM

Hi,

I want toknow that How to convert the value of text from 1- 1.00

or 10 -10.00 

am using this code

txtstartRange.Text = String.Format("{0:N1}",.0);

but output is From this code is 0.00



 

You are viewing reply posted by: dharmendr on Nov 25, 2016 01:54 AM.
Posted on Nov 25, 2016 01:54 AM

Hi droiddeve,

 Refer the below code.

string no = "1";
string text = string.Format("{0:N2}", Convert.ToDecimal(no));