473,486 Members | 1,950 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Capturing Modifier Keys in ProcessCmdKey Event

I'm using the ProcessCmdKey event to capture various keys that are pressed.
However, I'm having trouble capturing the combination of the CTRL key and,
say, the DOWN key. If I just press the CTRL key alone, the KeyData value is
131089. But all the possibilities I'm finding in the Keys enumeration are
the following:

Keys.ControlKey = 17
Keys.Control = 131072
Keys.LControlKey = 162
Keys.RControlKey = 163

Question:
How would I capture when the user presses the CTRL key at the left end of
the keyboard together with the DOWN arrow?

I've tried

If KeyData = Keys.Down & <each of those listed above> Then
'
'
'
End IF

and have also tried a logical 'And'. Nothing seems to work so far. Thanks.
Nov 21 '05 #1
2 6061
See if this helps

http://msdn.microsoft.com/library/de...isualBasic.asp


"Phil Galey" <pa*****@starcalif.com.nospam> wrote in message
news:Ox**************@TK2MSFTNGP15.phx.gbl...
I'm using the ProcessCmdKey event to capture various keys that are
pressed.
However, I'm having trouble capturing the combination of the CTRL key and,
say, the DOWN key. If I just press the CTRL key alone, the KeyData value
is
131089. But all the possibilities I'm finding in the Keys enumeration are
the following:

Keys.ControlKey = 17
Keys.Control = 131072
Keys.LControlKey = 162
Keys.RControlKey = 163

Question:
How would I capture when the user presses the CTRL key at the left end of
the keyboard together with the DOWN arrow?

I've tried

If KeyData = Keys.Down & <each of those listed above> Then
'
'
'
End IF

and have also tried a logical 'And'. Nothing seems to work so far.
Thanks.

Nov 21 '05 #2
It may be a crude solution, but you can set a form variable and in the
KeyDown and keyup events, toggle a boolean variable to indicate if the
control key is pressed when one of the other keys is caught by ProcessCmdKey.
--
Dennis in Houston
"Phil Galey" wrote:
I'm using the ProcessCmdKey event to capture various keys that are pressed.
However, I'm having trouble capturing the combination of the CTRL key and,
say, the DOWN key. If I just press the CTRL key alone, the KeyData value is
131089. But all the possibilities I'm finding in the Keys enumeration are
the following:

Keys.ControlKey = 17
Keys.Control = 131072
Keys.LControlKey = 162
Keys.RControlKey = 163

Question:
How would I capture when the user presses the CTRL key at the left end of
the keyboard together with the DOWN arrow?

I've tried

If KeyData = Keys.Down & <each of those listed above> Then
'
'
'
End IF

and have also tried a logical 'And'. Nothing seems to work so far. Thanks.

Nov 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1368
by: SpinningCone | last post by:
Im currently building a MUD telnet client in VB .NET and am having trouble mapping functionality to certain keys. the user is focused on a command textbox and can enter text and send it etc etc...
1
2292
by: bj | last post by:
How to process arrow keys? Hello I need to catch arrow keys down event from control derivied from usercontrol -OnKeyDown method seems to work for all keys besides arrow keys -however OnKeyUp...
2
2341
by: JPSutor | last post by:
I need to capture multiple keys with the keyUp event (Ex. Tab + 7) I can captuee individual keys by I'm not sure how to caputre multiple keys
1
1403
by: Serdge Kooleman | last post by:
i would like to write my event that will react on specific keys in my custom DataGrid (WinForms)... please help to do this. so far i have this custom grid... and i create it in main object ...
3
5236
by: MLM450 | last post by:
I have a control that handles the KeyDown event but it does not seem to execute when a combination of keys is pressed - like CTRL+Z. If I press CTRL, it executes. If I press Z, it executes. But the...
2
4231
by: senfo | last post by:
Hello all, To help alleviate human error, I'm developing an application that uses a barcode reader to fill in a value in a TextBox control. The barcode reader is connected to the PC through the...
2
1603
by: Mohammad Omer Nasir | last post by:
Hi, I am working on vs2k5 IDE for C# development. I made one Form which has one button on it. I tried to override KeyDown message on From but KeyDown message received. if Form does not...
0
2828
by: Andrus | last post by:
I have combobox column in DataGridView. Up and down error keys should be used to navigate previous and next row in grid. For this I override them in ProcessCmdKey() event. When combobox...
2
4742
by: =?Utf-8?B?SmVzcGVyLCBEZW5tYXJr?= | last post by:
I have a tabcontrol where I want to capture the CTRL+C key combination. My tabcontrol has on its tabpages some treeView controls. My intention is to intercept the event of pressing the CTRL+C when...
0
6964
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7123
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7173
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7305
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
4863
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3070
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1378
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
598
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
259
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.