Click here to Skip to main content
15,891,529 members
Home / Discussions / C#
   

C#

 
GeneralRe: s Text Property in a TreeNode Pin
Heath Stewart22-Apr-04 4:14
protectorHeath Stewart22-Apr-04 4:14 
GeneralRe: s Text Property in a TreeNode Pin
Bill Dean22-Apr-04 4:24
Bill Dean22-Apr-04 4:24 
GeneralRe: s Text Property in a TreeNode Pin
Heath Stewart22-Apr-04 4:30
protectorHeath Stewart22-Apr-04 4:30 
GeneralRe: s Text Property in a TreeNode Pin
Bill Dean22-Apr-04 4:41
Bill Dean22-Apr-04 4:41 
GeneralCircular Buffer Technique question Pin
TimTM22-Apr-04 3:45
TimTM22-Apr-04 3:45 
GeneralRe: Circular Buffer Technique question Pin
Jeremy Kimball22-Apr-04 5:48
Jeremy Kimball22-Apr-04 5:48 
GeneralRe: Circular Buffer Technique question Pin
TimTM22-Apr-04 8:10
TimTM22-Apr-04 8:10 
GeneralRe: Circular Buffer Technique question Pin
scadaguy22-Apr-04 6:26
scadaguy22-Apr-04 6:26 
GeneralRe: Circular Buffer Technique question Pin
TimTM22-Apr-04 8:04
TimTM22-Apr-04 8:04 
GeneralRe: Circular Buffer Technique question Pin
scadaguy22-Apr-04 8:44
scadaguy22-Apr-04 8:44 
GeneralRe: Circular Buffer Technique question Pin
TimTM22-Apr-04 9:01
TimTM22-Apr-04 9:01 
GeneralWindows Forms DataGrid Pin
dcronje22-Apr-04 3:39
dcronje22-Apr-04 3:39 
GeneralRe: Windows Forms DataGrid Pin
Heath Stewart22-Apr-04 5:04
protectorHeath Stewart22-Apr-04 5:04 
GeneralRe: Windows Forms DataGrid Pin
Jeremy Kimball22-Apr-04 6:08
Jeremy Kimball22-Apr-04 6:08 
GeneralRe: Windows Forms DataGrid Pin
Heath Stewart22-Apr-04 7:24
protectorHeath Stewart22-Apr-04 7:24 
GeneralRe: Windows Forms DataGrid Pin
Jeremy Kimball22-Apr-04 7:59
Jeremy Kimball22-Apr-04 7:59 
Generalmdb Synchronize Pin
basdanny22-Apr-04 3:00
basdanny22-Apr-04 3:00 
GeneralVss 6.0c Pin
sreejith ss nair22-Apr-04 2:14
sreejith ss nair22-Apr-04 2:14 
GeneralRe: Vss 6.0c Pin
Heath Stewart22-Apr-04 2:53
protectorHeath Stewart22-Apr-04 2:53 
GeneralRemote Debugging Pin
MrEyes22-Apr-04 1:53
MrEyes22-Apr-04 1:53 
GeneralRe: Remote Debugging Pin
Heath Stewart22-Apr-04 2:55
protectorHeath Stewart22-Apr-04 2:55 
GeneralRe: Remote Debugging Pin
Tom Larsen22-Apr-04 4:41
Tom Larsen22-Apr-04 4:41 
GeneralEvent in visual C# Pin
Hemant Mane22-Apr-04 0:57
Hemant Mane22-Apr-04 0:57 
GeneralRe: Event in visual C# Pin
A.Wegierski22-Apr-04 1:22
A.Wegierski22-Apr-04 1:22 
GeneralRe: Event in visual C# Pin
Heath Stewart22-Apr-04 2:59
protectorHeath Stewart22-Apr-04 2:59 
There's many ways of doing this. If you want to catch these in your derivative class, override OnKeyDown. External to your class, handle the KeyDown event. This is to catch and potentially "handle" the key without it being passed to the target window. If you don't care about stopping it from being dispatched, you can handle either KeyPress or KeyUp.

In there, you actually use the KeyEventArgs - not the EventArgs like the other response mentioned - to get the Keys enumeration member for pressed keys, or just the ASCII character value itself. See the documentation for the KeyEventArgs members for more details.

If you want to catch keys throughout your application (say, for configurable hot keys), implement the IMessageFilter class and add your implementing using Application.AddMessageFilter. You get a Message structure that contains the message (such as WM_KEYDOWN) and you can get the data from the WParam and LParam properties. You can also return true to signal that you've handled it and the message should not be dispatched.

 

Microsoft MVP, Visual C#
My Articles

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.