mercredi 3 avril 2019

Is there a way to compare a String converted into a float with an actual float value into an if-statement?

When Validating a button ,I converted the String value into a float one, but when I am trying to compare the converted value with an actual float I obtain compile errors. I want to create a comparison in this if in order to not permit values under 50 to be written in the application.

private void tbBid_Validating(object sender, CancelEventArgs e)
        {
            var amount = 12345678.0f;
            tbBid.Text = amount.ToString();
            if(amount.ToString()<50)
            {
                e.Cancel = true;

                epbid.SetError(tbBid,">50 lei");
            }

        }

Aucun commentaire:

Enregistrer un commentaire