Validate an edit control
How do you guys validate an edit control to accept only some chars?
I have a theory about it...
1.- subclass the edit control
2.- trap the WM_KEYPRESS or WM_CHAR
3.- test the character stroke.
is this the proper way?
Additional: I'm trying to accept only the following chars: 0-9 and .
WS_CHILD | WS_VISIBLE | WS_TABSTOP |
ES_NUMBER | ES_CENTER,
Use EN_UPDATE and scan for any illegal chars, you can use ES_NUMBER but it doesn't allow decimal separators to be entered. Either way, you have to do some additional work.
Well, I'll be... you learn something new every day.
Originally Posted by adeyblue
Thanks, I'll try EN_UPDATE