hotkey

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

hi, i was wondering how i can create hotkeys for my form? like if it involves
a select case for the keydown event ro what so if anyone could help with
this, thatd b great
 
Set the Forms "KeyPreview" property to True then in the Forms "KeyPress"
event, you can get access to the keys before the controls do and intercept by
setting the KeyEventArgs "Handled" property to True.
 
iwdu15 said:
hi, i was wondering how i can create hotkeys for my form? like if it
involves
a select case for the keydown event

The solution depends on what you consider to be a hotkey.

You can assign keyboard accelerators to various Windows Forms controly by
preceeding a character of their captions (property 'Text') with the "&"
character. If "&Start" is assigned to a button's caption, the user can
press Alt+S to raise the button's 'Click' event.

Another method to provide keyboard accelerators is using a menu bar
(MainMenu component). Each menu item has a 'Shortcut' property. If the
shortcut gets pressed, the according menu item's 'Click' event handler is
invoked. When using this approach the menu items do not even need to be
visible in order to make the shortcuts work.

The third alternative is to set the form's 'KeyPreview' property to 'True'
and handle the form's 'KeyDown'/'KeyUp' events.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top