A strange issue is occuring in my application.
I have a user entry process with a series of steps, guided by msgs and a single splash form. The app checks that the user follows the required steps and stores data at the end of the process, during which keypresses (rtn or esc) are required at certain points. After completing the process once, the user may choose to repeat the steps followed.
On the first attempt all keypresses are detected and handled in the form keydown event. However, on the second pass, detection of the Return keypress ceases. All other key presses are caught and processed correctly, but Return does not even raise the keydown event.
Any ideas or suggestions gratefully recieved!
Rgds,
Stuart Kirk
Loading

Stuart Kirk6 reputationPosted Aug 26, 2008, 8:20 AM EDT
AlanRank #669 · 3.6K reputationPosted Aug 26, 2008, 8:22 AM EDT
It sounds like the return key is going straight to a control on the form after the first pass.
I take it that you've got the Form's KeyPreview property set to True to capture any key presses at form level to start with.
Is it possible that you're changing the AcceptButton property at some later point?
Stuart Kirk6 reputationPosted Aug 28, 2008, 2:50 AM EDT
Keypreview = true
There is no modification of the acceptbutton in my code...
Any ideas?
AlanRank #669 · 3.6K reputationPosted Aug 28, 2008, 7:44 AM EDT
Not really unless you're calling methods such as IsInputKey which could change the status of the return key.
One thing you could try is to explicitly set the AcceptButton property to Nothing before each run, just in case it's being changed indirectly by some other code.
joseph2 reputationPosted Jan 5, 2009, 9:39 AM EST
A not perfect but good solution might be to use
PreviewKeyDown
This will get the enter key press but isn't quite ASCII for digits.
akhil18 reputationPosted Mar 25, 2009, 4:31 AM EDT
then click event will fire and not keypress of button