Capturing Shift+Return when AcceptButton is used

H

Henrik Jernevad

Hi,

I've got a search form with the search button used as AcceptButton for
the form and everything works as expected. However, I want to be able
to capture not only Return, but also Shift+Return in which case I want
to change some settings and then perform the search as normal.

As I understand it, when an AcceptButton is used the form's KeyDown
event handler doesn't receive the Return key event even with
KeyPreview on. If I remove the AcceptButton the Return key event gets
through as expected. Is there a good way to find out whether Shift is
currently pressed form within the accept button's Click event handler?
Is there a way to display the search button with "AcceptButton style"
without it actually being accept button?

Any thoughts would be appreciated!
Regards
Henrik Jernevad
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top