473,472 Members | 1,702 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

how to get Shift key status

Dear all,
How do I get information if Shift is pressed in a mouse wheel handler.
Thanks,
Boni
Sub MouseWheel(ByVal sender As Object, ByVal e As
System.Windows.Forms.MouseEventArgs) 'mouse whill handler

If SHIFT is pressed and e.delta.....

End Sub
Nov 21 '05 #1
5 8919
Hello Boni,

You may be looking for this:

If Control.ModifierKeys = Keys.Shift Then...
Regards.
"Boni" <oilia@nospam> escribió en el mensaje news:On**************@TK2MSFTNGP09.phx.gbl...
| Dear all,
| How do I get information if Shift is pressed in a mouse wheel handler.
| Thanks,
| Boni
| Sub MouseWheel(ByVal sender As Object, ByVal e As
| System.Windows.Forms.MouseEventArgs) 'mouse whill handler
|
| If SHIFT is pressed and e.delta.....
|
| End Sub
|
|
Nov 21 '05 #2
"José Manuel Agüero" <chema012 en hotmail.com> schrieb:
You may be looking for this:

If Control.ModifierKeys = Keys.Shift Then...


.... or, if you want to get the state of the key even if other modifier keys
are pressed:

\\\
If CBool(Control.ModifierKeys And Keys.Shift) Then
...
End If
///

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

Nov 21 '05 #3
Thank you Jose', Herfried.
BTW, what is the difference between keys.shift and keys.shiftkey
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> schrieb im Newsbeitrag
news:eW*************@TK2MSFTNGP10.phx.gbl...
"José Manuel Agüero" <chema012 en hotmail.com> schrieb:
You may be looking for this:

If Control.ModifierKeys = Keys.Shift Then...


... or, if you want to get the state of the key even if other modifier
keys are pressed:

\\\
If CBool(Control.ModifierKeys And Keys.Shift) Then
...
End If
///

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

Nov 21 '05 #4
Keys.Shift is a "modifier key" and Keys.ShiftKey is a "key".
You use Keys.ShiftKey when you want to check only if the shift key is pressed.
You use Keys.Shift when you are checking for another key combined with the shift and, maybe, other modifier keys.

Also, you should always use bitwise operations, as Herfried noted, combined conveniently, depending if you can or cannot ignore other modifier keys.

Regards.
"Boni" <oilia@nospam> escribió en el mensaje news:ur**************@TK2MSFTNGP12.phx.gbl...
| Thank you Jose', Herfried.
| BTW, what is the difference between keys.shift and keys.shiftkey
| "Herfried K. Wagner [MVP]" <hi***************@gmx.at> schrieb im Newsbeitrag
| news:eW*************@TK2MSFTNGP10.phx.gbl...
| > "José Manuel Agüero" <chema012 en hotmail.com> schrieb:
| >>You may be looking for this:
| >>
| >>If Control.ModifierKeys = Keys.Shift Then...
| >
| > ... or, if you want to get the state of the key even if other modifier
| > keys are pressed:
| >
| > \\\
| > If CBool(Control.ModifierKeys And Keys.Shift) Then
| > ...
| > End If
| > ///
| >
| > --
| > M S Herfried K. Wagner
| > M V P <URL:http://dotnet.mvps.org/>
| > V B <URL:http://classicvb.org/petition/>
|
|
Nov 21 '05 #5
"KahurangiKea" <no****@developmentnow.comschrieb:
Sorry, above posting is incorrect. Only returns true if Shift is only
modifier key pressed, and

dim shiftPressed as Boolean = cBool(Control.ModifierKeys = Keys.Shift)

is simpler.
Write '... = (Control.ModifierKeys = Keys.Shift)' to determine if the shift
modifier key is pressed only, and write '... = CBool(Control.ModifierKeys
And Key.Shift)' to determine if the shift modifier key and possibly other
modifier keys are pressed.

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

Jul 21 '07 #6

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

Similar topics

1
by: John C. Young | last post by:
Hi, I work in a 24/7 Network Operation Center. One of my responsibilities is to provide a report of all of the happenings during my 8 hour shift to those who are scheduled after me and to...
5
by: Chris Williams | last post by:
Hi all, I am becoming a little stressed with the age-old problem of detecting when a user types (for example) a quote character ("). On a UK keyboard, I can look for a 2 + shift mask; on US,...
7
by: Paul Cooper | last post by:
Dear All, I am working on a piece of Javascript code that needs to detect a mouse-click, shift-click and control-click. The code is not my own - it is a part of a much larger suite of routines....
43
by: Mehta Shailendrakumar | last post by:
Hello, Can anyone suggest me operator to perform arithmetic shift in C? May it be for a perticular compiler. Thank you in advance. Regards, Shailendra
2
by: phil cunningham | last post by:
How do I detect if the user is holding down a SHIFT or CONTROL key whilst moving the mouse. Sorry for the trivial question but I'm just getting started with this Phil
7
by: Csaba Gabor | last post by:
I'd like to detect the shift key when a button is "clicked" in Firefox/Mozilla. If the button is clicked with the mouse, no problem. However, if the onclick event is keyboard originated, then my...
3
by: Amy Smith | last post by:
Hello there, I am having a small problem which been challenging me for few days and need help or advice. I am trying to calculate the day-shift for employees based on the time they started and...
3
by: Pietro | last post by:
Hi all, First of all I'd like to thank you very very much ,as finally after many years of searching,I could find a code to disable/enable the shift key,but actually i cannot use the code as I'm...
4
by: Johnny J. | last post by:
How do you check if the Control, Shift or Alt key is pressed at any given time (not necessarily in a keyevent)? Cheers, Johnny J.
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
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
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
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.