Skip to main content

What do I need to set up so that I can determine if a function key has been pressed whilst the user is on a Form?

Thanks.

What do I need to set up so that I can determine if a function key has been pressed whilst the user is on a Form?

Thanks.

Trap the KeyDown event on the form.

      method-id Form1_KeyDown final private.
      procedure division using by value sender as object e as type System.Windows.Forms.KeyEventArgs.
|          if e::KeyCode = type Keys::F1
             invoke type MessageBox::Show("F1 was pressed")
             set e::Handled to true
          end-if  
      end method.