Shortcut Key question (i.e. "&Submit")

R

rh

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?
 
H

Herfried K. Wagner [MVP]

rh said:
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.
 

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