-2

I'v problem how to Convert textbox to float c#

I have in my textbox.text example

8.1.1

I did this cod but error

//

         int a ;

         a = val (model.Text);

        //

        if (a >= 6)
        {

        }

Convert textbox to float

some one pleas help me

  • not eccapt erorr – abo yahya Jun 12 '19 at 19:48
  • Can you clarify your question, you your title and code say `int`, but the question body says `float`. Which is it? And if you are trying to convert the value 8.1.1 it's not going to work in either case because it's not a valid integer _or_ float value. Please review [ask]. – jmoerdyk Jun 12 '19 at 20:02

1 Answers1

-1

in order to convert textbox text into a float you need to use float.Parse()

    float a;
    a = float.Parse(model.Text);