ctrl-click

  • Thread starter Thread starter Tom
  • Start date Start date
T

Tom

Hi,

I would like to know wether the Ctrl-key is pressed down
when i click a button on my win form.

how can i do this?

tia,

Tom
 
First of all set your forms KeyPreview property to True, then trap the
KeyDown or KeyUp events and find out.


Regards - OHM
 
OHM/Tom,

There is an easy way to find out if Ctrl is held down when you press a
button.

In the Click event of the button, you can see if the Ctrl key is
currently pressed down with the following code .

If btnYourButton.ModifierKeys = Keys.Control Then
MsgBox("The control key is currently pressed down.")
End If


lostdreamz
 
* lostdreamz said:
There is an easy way to find out if Ctrl is held down when you press a
button.

In the Click event of the button, you can see if the Ctrl key is
currently pressed down with the following code .

If btnYourButton.ModifierKeys = Keys.Control Then

Better:

\\\
If (Control.ModifierKeys And Keys.Control) <> 0 Then
...
End If
///
 
Back
Top