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. 4 4876
Johnny J. wrote:
How do you check if the Control, Shift or Alt key is pressed at any
given time (not necessarily in a keyevent)?
You can use the Windows.Forms.C ontrol.Modifier Keys property:
\\\
If (Windows.Forms. Control.Modifie rKeys And Keys.Control) <0 Then
Debug.WriteLine ("Ctrl is pressed")
End If
If (Windows.Forms. Control.Modifie rKeys And Keys.Shift) <0 Then
Debug.WriteLine ("Shift is pressed")
End If
If (Windows.Forms. Control.Modifie rKeys And Keys.Alt) <0 Then
Debug.WriteLine ("Alt is pressed")
End If
///
HTH,
--
(O)enone
Thanks a lot - that solved my problem
Cheers,
Johnny J.
"(O)enone" <oe****@nowhere .comwrote in message
news:eM******** ******@TK2MSFTN GP03.phx.gbl...
Johnny J. wrote:
>How do you check if the Control, Shift or Alt key is pressed at any given time (not necessarily in a keyevent)?
You can use the Windows.Forms.C ontrol.Modifier Keys property:
\\\
If (Windows.Forms. Control.Modifie rKeys And Keys.Control) <0 Then
Debug.WriteLine ("Ctrl is pressed")
End If
If (Windows.Forms. Control.Modifie rKeys And Keys.Shift) <0 Then
Debug.WriteLine ("Shift is pressed")
End If
If (Windows.Forms. Control.Modifie rKeys And Keys.Alt) <0 Then
Debug.WriteLine ("Alt is pressed")
End If
///
HTH,
--
(O)enone
On 3 Sep, 13:19, "Johnny J." <j...@altcom.se wrote:
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.
If (My.Computer.Ke yboard.AltKeyDo wn) Then
or
If (My.Computer.Ke yboard.CtrlKeyD own) Then
or
If (My.Computer.Ke yboard.ShiftKey Down) Then
Phillip Taylor
Thanks Philip :-)
/Johnny J.
"Phillip Taylor" <Ph************ *****@gmail.com skrev i meddelandet
news:11******** *************@2 2g2000hsm.googl egroups.com...
On 3 Sep, 13:19, "Johnny J." <j...@altcom.se wrote:
>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.
If (My.Computer.Ke yboard.AltKeyDo wn) Then
or
If (My.Computer.Ke yboard.CtrlKeyD own) Then
or
If (My.Computer.Ke yboard.ShiftKey Down) Then
Phillip Taylor This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
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,...
|
by: Vazz |
last post by:
I am trying to capture the key combination "Control + Shift + Enter"
in a KeyDown event. I am able capture "Control + Enter" using
(e.KeyCode == Keys.Enter && e.Modifiers == Keys.Control). How do I
check if there are two Modifiers?
|
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
|
by: Barguast |
last post by:
When a control's 'Click' event is triggered, is there a way I can test
whether the CTRL / Alt / Shift keys are pressed as well? I've thought about
capturing KeyDown events before the click but this assumes that the control
is in focus which won't necessarily be so.
|
by: Moe Sizlak |
last post by:
Hi There,
I am trying to return the value of a listbox control that is included as a
user control, I can return the name of the control but I can't access the
integer value of the selected item, what do I need to do in order to return
the "option value" of the control?
Moe
!--- returned value of the control
| |
by: Colin Graham |
last post by:
I am using the following code on my form to capture whether the tab
control has been pressed.
Protected Overrides Function ProcessCmdKey(ByRef msg As
System.Windows.Forms.Message, ByVal keyData As
System.Windows.Forms.Keys) As Boolean
Select Case keyData
Case Keys.Tab
MsgBox("tab pressed")
|
by: Steph. |
last post by:
Hi,
A simple question : How can I detect if the CTRL key is pressed when User click on a control ?
Thanks,
Steph.
|
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...
|
by: Charles Law |
last post by:
I'll kick myself when you tell me, but ...
I have a user control on a form, and I want the user control to see the
arrow keys when I press them. If I press just about any other key the
control's KeyDown event is fired, but not when I press a direction key.
I want to see them in the KeyDown event so that I can respond as soon as the
key is depressed, and I want to detect when the key is held down so that I
can perform an action...
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
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...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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...
|
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...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
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...
| | |