Recognize Multiple keys being pressed
-
I just want to start by saying that i have been out of the programming game for a while and i just started to do a little work on a old project of mine. All i want to do is be make a listbox recognize when more than one key is pressed. To be exact, i want ctrl+A to do a select all in the listbox. I figure that .NET has something that i do not know about that is builtin to make this task easy. Thank you for a help that is provided.
-
I just want to start by saying that i have been out of the programming game for a while and i just started to do a little work on a old project of mine. All i want to do is be make a listbox recognize when more than one key is pressed. To be exact, i want ctrl+A to do a select all in the listbox. I figure that .NET has something that i do not know about that is builtin to make this task easy. Thank you for a help that is provided.
there are two easy ways to get that: 1. provide a MainMenu and some Menu Item that allows the user to do whatever it is you want the shortcut to do too. Then set the shortcut for that Menu Item. Done. 2. Set Form.KeyPreview true, provide a Form.KeyDown handler that checks for
KeyEventArgs.Control And KeyEventArgs.KeyCode=Keys.A
BTW: you can always get the instantaneous state of the modifier keys from Control.ModifierKeys :)Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read code that is properly formatted, adding PRE tags is the easiest way to obtain that.