473,698 Members | 2,524 Online
Bytes | Software Development & Data Engineering Community
+ 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(ByVa l sender As Object, ByVal e As
System.Windows. Forms.MouseEven tArgs) 'mouse whill handler

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

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

You may be looking for this:

If Control.Modifie rKeys = Keys.Shift Then...
Regards.
"Boni" <oilia@nospam > escribió en el mensaje news:On******** ******@TK2MSFTN GP09.phx.gbl...
| Dear all,
| How do I get information if Shift is pressed in a mouse wheel handler.
| Thanks,
| Boni
| Sub MouseWheel(ByVa l sender As Object, ByVal e As
| System.Windows. Forms.MouseEven tArgs) '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.Modifie rKeys = Keys.Shift Then...


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

\\\
If CBool(Control.M odifierKeys 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******** *****@TK2MSFTNG P10.phx.gbl...
"José Manuel Agüero" <chema012 en hotmail.com> schrieb:
You may be looking for this:

If Control.Modifie rKeys = Keys.Shift Then...


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

\\\
If CBool(Control.M odifierKeys 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******** ******@TK2MSFTN GP12.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******** *****@TK2MSFTNG P10.phx.gbl...
| > "José Manuel Agüero" <chema012 en hotmail.com> schrieb:
| >>You may be looking for this:
| >>
| >>If Control.Modifie rKeys = Keys.Shift Then...
| >
| > ... or, if you want to get the state of the key even if other modifier
| > keys are pressed:
| >
| > \\\
| > If CBool(Control.M odifierKeys 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
"KahurangiK ea" <no****@develop mentnow.comschr ieb:
Sorry, above posting is incorrect. Only returns true if Shift is only
modifier key pressed, and

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

is simpler.
Write '... = (Control.Modifi erKeys = Keys.Shift)' to determine if the shift
modifier key is pressed only, and write '... = CBool(Control.M odifierKeys
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
2671
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 management. For a number of years, this has been done via email format, cutting and pasting to a template.
5
2469
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, single quote + shift mask. I don't want to have to know every single international keyboard layout just to know when a shifted character has been entered. If anybody has any ideas to share, I'd be very grateful!
7
15497
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. The code as it stands does not work in Firefox, and I suspect that the task of feature detection (which currently depends on browser detection) can be carried out better. The result should be that opcode is set to 0,1 or 2 dor click,...
43
26501
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
2484
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
7194
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 method is not working. Same thing for SELECT elements. The simple web page below shows the issue. Click with the mouse while holding down the shift key, and the Shift key's status registers. However, use Shift+Alt+o, or either (while the...
3
4195
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 finish working, I will only have 2 shifts 1 or 2 . Shift one changes based on the location however any thing else is shift 2. The problem I am having is when someone signed in after midnight; I need to report his time under shift 2 for the...
3
11654
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 very new to VBA,i tried to follow the instructions reported in the code,but i got no result,i still can use the shift key,can you explain in details how to use it correctly to enable/disable users from pressing shift key to view database windw?,the...
4
4873
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
9166
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9030
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8871
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6525
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5861
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4371
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4621
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3052
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 we have to send another system
3
2007
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.