Hi
im trying to see if the current character is between 2 values in the ASCII table (numeric). if they are then I wish to continue. It works except when you enter a value of less than the ASCII value of 57 it assumes that it's true when it really isnt
how can i tell it to see if the value entered is between the numbers in the ASCII table?
Code:foreach(char curChar in txtPortNumber.Text) { //is it a number? if (curChar >= 48 && curChar <= 57 == false ) { MessageBox.Show("Text entered is not numeric"); return false; } else { fullString += curChar; if (Convert.ToInt32(fullString) > 65535) { MessageBox.Show("Ports cannot be greater than 65535"); return false; } } }




Reply With Quote