Click here to Skip to main content
15,899,754 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
40*7.5=


Text box =5.33333333333333



I Need to display Just 6 Numbers Like this
Text box =5.333333
Posted
Comments
Sergey Alexandrovich Kryukov 13-Apr-15 14:11pm    
No, this is not a valid C# code.
—SA

For starters, 40 * 7.5 does not equal 5.33333333333333

It should be 40 / 7.5 = 5.33333333333333

Do your math, then format the text before setting the Textbox.

double dv = 40 / 7.5;
string newvalue = string.Format("{0:0.00}", dv);
textbox1.text = newvalue;
 
Share this answer
 
Comments
Member 11280947 13-Apr-15 14:27pm    
Thank You

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