954,514 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

string to float

can someone tell me how to convert a string to a float.

(Float)"1";


does not work.

choover12
Newbie Poster
22 posts since Sep 2010
Reputation Points: 10
Solved Threads: 0
 
float result;
if (Float.TryParse(myString, out result)) {
    // parse was successful and result contains the parsed value
} else {
    // parse failed
}
Momerath
Nearly a Senior Poster
3,386 posts since Aug 2010
Reputation Points: 1,232
Solved Threads: 558
 

thank you but i already came up with an answer.

choover12
Newbie Poster
22 posts since Sep 2010
Reputation Points: 10
Solved Threads: 0
 

float fCost = Convert.ToInt64(TextBox9.Text);

Dolly.Oswal
Newbie Poster
1 post since Nov 2010
Reputation Points: 10
Solved Threads: 0
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: