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

(Float)"1";

does not work.

float result;
if (Float.TryParse(myString, out result)) {
    // parse was successful and result contains the parsed value
} else {
    // parse failed
}

thank you but i already came up with an answer.

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.