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

Re: Capturing Shift+Return when AcceptButton is used by Alexander

Alexander
Wed Nov 07 10:42:19 PST 2007

Please try use subclassing

http://www.alvas.net - Audio tools for C# and VB.Net developers


"Henrik Jernevad" <henrik.jernevad@gmail.com> ???????/???????? ? ????????
?????????: news:1190580901.935043.84200@n39g2000hsh.googlegroups.com...
> 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
>