I would need that (on a WinForm) if the key A is pressed, an event is triggered. I got this code from the MSDN site:
private void Form1_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode != Keys.A)
{
MessageBox.Show("Key 'a' was pressed.");
}
}
The problem is that this code doesn't work for me, there is no error message, but if I am on the form and press the key A there is no event triggered. I tried to use breakpoints, but it never enters the if
.
What is the problem here?