4
Reply

Converting string to float value.

abhishek aerrolu

abhishek aerrolu

17y
5.5k
0
Reply
    float num=Convert.ToSingle("5.3");
    use convertopction convert.TOfloat
    use the following code : float f1 = float.Parse(textBox1.Text.Trim());
    In the windows form, I have a text box which accept the float value Unable to convert the text box string to float, the code is as below. float f1=(float) textbox1.Text.Trim(); The error I get is "Cannot convert string to float"