Click here to Skip to main content
15,903,856 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i am using win form application this application in my win form their are multiple control in which control user mouse move ??
Posted
Updated 23-Aug-13 3:06am
v3
Comments
berrymaria 23-Aug-13 5:14am    
Hi, can you please improve your question? Make it more understandable.
phil.o 23-Aug-13 5:21am    
Please indicate the code you are using to convert string to float, and some examples of string values that are not converted correctly.
CodeBlack 23-Aug-13 5:25am    
can you please show your input, output you are getting and your expected output ?
[no name] 23-Aug-13 9:17am    
Please do not edit your question to ask a completely different question. It makes the questions and answer out of sync and gets confusing. Ask a separate question. And in this case, you will definitely need to improve it.

1 solution

Assuming that you mean you are converting a string like "12.350" to a float value, then the "final zero" is not truncated, it's just irrelevant: a float value does not store a precision so it has an infinite supply of zeros to the right of the decimal point.

What is actually happening is that when you convert the float back to a string for display, the irrelevant zero is not being displayed. You can force it by specifying a format when you display the value.

C#
float f = 12.350F;
Console.WriteLIne(f.ToString("00.000"));
will give "12.350"
C#
float f = 12.350F;
Console.WriteLine("{0:00.000}", f);
Will also give "12.350"
 
Share this answer
 
Comments
vilassagar 23-Aug-13 6:20am    
thank you
OriginalGriff 23-Aug-13 6:22am    
You're welcome!

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