0
votes

I have a simple window with an OK and a Cancel Button. I set the IsCancel property on the Cancel button to true. Simple enough. Now when I press the 'ESC' key the button click event fires. But by exident I found out that this also fires when I press the 'A' key. I then checked every other key on my keyboard but 'ESC' and 'A' where the only keys triggering this.

Is there any explanation on why this is happening? I would guess .NET 4.0 bug but maybe there is an actual reason for this.

I was also using Windows 8.

1
I am not able to reproduce this. Could you provide a sscce? - Default

1 Answers

1
votes

We don't have a lot to go on, but is it possible that the 'a' in cancel is underlined? Perhaps there is a keyboard shortcut in play on that button.

When you open your window, try pressing the 'ALT' key to see if the 'a' gets underlined.

See this for some more details: Underline letter in a button