Q
Problem solve Get help with specific problems with your technologies, process and projects.

Casting numeric text to a floating point number then posting it back

I like your char.isDigit() solution for validating WinForm user input to numeric. How do you then cast the resulting numeric text to a floating point number and after processing (to a metric value for instance) post it back to a textbox.text with tostring(), but round to a reasonable number of digits?
ToString() receives an optional formatting string with which you can control the number of digits to use, etc. Take a look at the MSDN documentation for Double.ToString() for some examples.
This was last published in September 2003

Dig Deeper on C# programming language

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.

-ADS BY GOOGLE

SearchCloudComputing

SearchSoftwareQuality

TheServerSide.com

SearchCloudApplications

Close