How can i disable pressing of special characters(@,#,$,%,^,&,*,~,!) on Editbox control?
-
Hi all, Please anyone can tell me how can i stop enter special cahracters (@,#,$,%,^,&,*,~,!) in Editbox. Thanks in advance.
IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH
You can perform it in three ways. One is override PreTranslateMessage. Another one is to subclass your Editbox. Also there is another one derive your custom editbox from CEditBox, on WM_CHAR message you can disbale special character.
-
Hi all, Please anyone can tell me how can i stop enter special cahracters (@,#,$,%,^,&,*,~,!) in Editbox. Thanks in advance.
IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH
Subclass CEdit and override subclass OnPreTranslate(). you can also do it with the EN_CHANGE event in your dialog class but that would require some logic of storing the string, comparing it with the previous one, finding if the new character is the one which you DON'T want etc etc. Hope it helps.
Somethings seem HARD to do, until we know how to do them. ;-)_AnShUmAn_
-
Subclass CEdit and override subclass OnPreTranslate(). you can also do it with the EN_CHANGE event in your dialog class but that would require some logic of storing the string, comparing it with the previous one, finding if the new character is the one which you DON'T want etc etc. Hope it helps.
Somethings seem HARD to do, until we know how to do them. ;-)_AnShUmAn_
-
Can you show any example of this. Thanks.
IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH
Hi, there is an excellent Codeproject article called CFilterEdit: Use Regular Expressions to filter your input by Ben Hanson. This can serve you well as a base clase for your problem. http://www.codeproject.com/KB/edit/FilterEdit.aspx[^] There are already some sample derived classes like * CCurrencyEdit * CDateTimeEdit * CFloatEdit * CIntEdit * CUIntEdit * CUIntRangeEdit * CSpin So long, Stefan