-1

like now, I just add one addition that less than 0, and I want to add one more condition that if the values that user entered are not numbers, still show the same messagebox.

        if(waist <= 0 || height <= 0)
        if (waist <= 0) {
            MessageBox.Show("Please enter a number that greater than 60");
        }
        if (height <=0 ) {
            MessageBox.Show("Please enther a number that greater than 120");
                }
Donald
  • 47
  • 5

1 Answers1

-1

You can do the following:

 String input = Console.ReadLine() //Or whatever you are using to catch the user input
int n;
    if(int.TryParse(input, out n)
    {
         //Your logic, use n or something
    }
    else
    {
         //print error that there is no numeric input
    }
M. Suurland
  • 725
  • 12
  • 31