Karl66
asked on
C# VS2008 how to recognize a key was pressed?
C# VS2008 how to recognize a key was pressed?
Lets say I create a form with nothing on it. If somone presses F1 I want a message to pop up. I went into events and tried a key pressed and key down event like if (e.KeyCode == Keys.F1)
{
MessageBox.Show("Test");
}
but when I press F1 nothing happens. Almost like the form isn't actively looking for the event?? Any thoughts!
Thanks!
Lets say I create a form with nothing on it. If somone presses F1 I want a message to pop up. I went into events and tried a key pressed and key down event like if (e.KeyCode == Keys.F1)
{
MessageBox.Show("Test");
}
but when I press F1 nothing happens. Almost like the form isn't actively looking for the event?? Any thoughts!
Thanks!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I believe that is because F1 is the system help key.