By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,990 Members | 2,279 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,990 IT Pros & Developers. It's quick & easy.

hotkey

P: n/a
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
--
-iwdu15
Nov 21 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
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.
--
Dennis in Houston
"iwdu15" wrote:
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
--
-iwdu15

Nov 21 '05 #2

P: n/a
"iwdu15" <iw****@discussions.microsoft.com> schrieb:
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.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.