I have a Button on a WinForm that has a text property = "&Submit".
I noticed that whenever I pressed the "S" key only (without pressing the
"Alt" key) the Button's click event would fire. I thought that it was only
supposed to fire if the combo "Alt+S" was pressed.
My problem is that I have another control (a DataGrid) that is suppoed to
respond to the "S" key being pressed and I don't want the Button's click
event to be fired. I only want it to be fired if the combo "Alt+S" is
pressed.
Any suggestions?
"rh" <rherrera@smci.com> schrieb:
>I have a Button on a WinForm that has a text property = "&Submit".
>
> I noticed that whenever I pressed the "S" key only (without pressing the
> "Alt" key) the Button's click event would fire. I thought that it was only
> supposed to fire if the combo "Alt+S" was pressed.
The button's 'Click' event is fired by pressing the S key if a control that
doesn't expect user input (like a button, for example) has focus. Alt+S
will work too if a textbox has the input focus.

Signature
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/