How to check if a decimal is less than or equal to an integer?

0

I have the following code:

   public bool CheckArena()
    {
        if (Convert.ToDecimal(porcentajeArena.Text) >= 60 && Convert.ToDecimal(porcentajeArena.Text) <= 71)
        {
             error0.Text = "";
             return true;

        }
        else 
        {
            error0.Text = "Error. El campo Arena requiere de un valor entre 60% y 71%";
            }

For textbox I pass for example 63.5 but I throw the error saying that the value should be between 60 and 71.

    
asked by Agustín Morelle 23.07.2017 в 20:51
source

1 answer

0

The problem is that you are entering "63.5" and passing the value with a period ".". For conversion to work correctly you should enter "63.5" the value with a comma ","

If you can not modify from the control panel - > region - > regional and language settings

Greetings

    
answered by 24.07.2017 в 15:55