Simple Question - 'F' Keys

  • Thread starter Thread starter Stu
  • Start date Start date
S

Stu

Hi,

I'm fairly new to the .NET environment and to C#. I have a question which is
probably very simple but at the moment I cannot see to find the answer...

I have a Windows Form application and would like to trap the 'F' key presses
which will then do things in the app. My question is 'How do I handle the
'F' key presses?' I've tried the 'KeyPress', KeyUp' and KeyDown' handlers
for the form but this does not seem to work.

Any suggestions would be helpful,

Thanks,

Stu
 
Hi Stu,

KeyUp and KeyDown should work just fine, unless it is a system shortcut,
such as Ctrl-F4.
 
Hi Stu,

As Dmytro said, use KeyUp/Down and search for Keys.F1 etc.

However, if on your form you have some other key trapping controls like TextBoxes, you need to set Form.KeyPreview = true to get notified.
 
Back
Top