retep
asked on
EditBox filter.
An easy way to make sure that the user only enters a key between '0..9', which means I only want the editbox to be able to contain numbers...
Regards
Peter :-)
Regards
Peter :-)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
just include also the backspace
If not (Key in ['0'..'9', #13, #8]) then
Key := #0; //reject all other keys
If not (Key in ['0'..'9', #13, #8]) then
Key := #0; //reject all other keys
ASKER
Just what I was looking for. Since my question was ment for TEdit, I have choosen to accept this particular answer.
But thanks to you all!
Peter :-)
But thanks to you all!
Peter :-)
you have at least two options to try out. One is to use TMaskEdit with a proper mask to only accept numbers and the other is to intercept all keypresses to a normal TEdit and reject/ignore them if they aren't numbers.
The first solution is much easier and I'd suggest that you start working with TMaskEdit.
Ciao, Mike