Moneo:
Quote:Aga,
You covered all the salient elements for validating an input integer number, but I think your solution is a bit complicated. The newbee will just get lost.
Well, yeah, but I made it a function...
Quote:Example: all that business usint the intlimit array is cute, but way too hairy. Why not just compare the 5 digit number to 32767 or 32768 if negative?
Well, you could do it by entering the limits as a string, doing VAL() on them, and comparing, but it would not be as efficient. If you set it to a number and do a > or < comparison for the whole thing, that would be ok but it might create errors since VAL() converts to floating integers I think. It might not, but doing it like that makes you depend on VAL() being able to convert to 99,999.
Quote:Also, if it wasn't for your 5 digit restriction in order to use the intlimit array, you wouldn't have to suppress leading zeros.
Yeah, but I'd rather give the VAL() function something without zeroes.
I shudder to think of what happens to the world if you are ever a programming teacher, cha0s. :evil:
cha0s: remind me to stab you once in a while. First, you're depending on the user having knowledge of the ASCII positioning of "0123456789". Second, please capitalize commands either completely in lowercase or completely in uppercase, not in first-letter-uppercase, or I will have to stab you. Third, this is a QB post and your program will not work in QB. (notice LEFT does not have a "$") Fourth, please use appropriate variables not "ch", "x", and "stuck", or I will have to stab you. (again) FIFTH, you never set your function get_numeric_input to anything! SIXTH,
'( ch >= "a" And ch <= "z" ) Or ( ch >= "A" And ch <= "Z" )'
just says that the number CANNOT be between "A" and "Z" or 'a" and "z". What about "<", " ", ".", etc.? The correct way is:
' (ch >= "9" AND ch <= "0")
SEVENTH, you are not looping through the entire string of x...
EIGHTH, you do not check limits for the INTEGER of -32767 to 32768.
NINTH, I already wrote a function.