Control, Shift, Alt Status

  • Thread starter Thread starter Johnny J.
  • Start date Start date
J

Johnny J.

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.
 
Johnny said:
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.Control.ModifierKeys property:

\\\
If (Windows.Forms.Control.ModifierKeys And Keys.Control) <> 0 Then
Debug.WriteLine("Ctrl is pressed")
End If
If (Windows.Forms.Control.ModifierKeys And Keys.Shift) <> 0 Then
Debug.WriteLine("Shift is pressed")
End If
If (Windows.Forms.Control.ModifierKeys And Keys.Alt) <> 0 Then
Debug.WriteLine("Alt is pressed")
End If
///

HTH,
 
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.Keyboard.AltKeyDown) Then

or

If (My.Computer.Keyboard.CtrlKeyDown) Then

or

If (My.Computer.Keyboard.ShiftKeyDown) Then

Phillip Taylor
 
Thanks Philip :-)

/Johnny J.


Phillip Taylor said:
If (My.Computer.Keyboard.AltKeyDown) Then

or

If (My.Computer.Keyboard.CtrlKeyDown) Then

or

If (My.Computer.Keyboard.ShiftKeyDown) Then

Phillip Taylor
 
Back
Top