eyDown Event(Problem in detecting "SHIFT + 1")

apremanandh's Avatar, Join Date: Nov 2007
Newbie Member
Hi friends,

I working with MFC and i am a beginner also,
I am Trying to validate an editbox (which take a phone number as input with starting character '+' should be allowed if user wishes).
i am not able to block special characters(!,@,#,$,%,^,&,*,(,))

Please help me to solve this problem.
0
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
you need to sub class the CEdit class and have your own event handler for the keypress / keydown event and then handle the characters accordingly. Also if you wish you can validate in the lost focus event there.
0
apremanandh's Avatar, Join Date: Nov 2007
Newbie Member
Ok i tried out this logic and it works, but one problem, this nChar Param in OnKeyDown always showing the Capital letter Ascii only. any solution for that
0
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
That should not be the case unless you have caps lock on.