Click here to Skip to main content
15,898,857 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
i have a vb.net code for fomating textbox into two digit decimal place
textbox1.Text = Format(Double.Parse(textbox1.Text), "########0.00")

how i convert this code in to C#
or any other ways to do this

What I have tried:

textbox1.Text = Format(Double.Parse(textbox1.Text), "########0.00")
Posted
Updated 19-Dec-18 4:33am
Comments
Member 15182416 4-May-21 0:36am    
thanks it`s word

1 solution

Below should work. Also you may need some code to make sure your test box validation before this.

C#
textbox1.Text = String.Format("{0:N2}", double.Parse(textbox1.Text));
 
Share this answer
 
Comments
aneeshvis 21-Dec-18 9:52am    
thanks very much

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