By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,219 Members | 2,242 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,219 IT Pros & Developers. It's quick & easy.

ctrl-click

P: n/a
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
Nov 20 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
First of all set your forms KeyPreview property to True, then trap the
KeyDown or KeyUp events and find out.
Regards - OHM

Tom wrote:
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


--
Best Regards - OHM

O_H_M{at}BTInternet{dot}com
Nov 20 '05 #2

P: n/a
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

On Tue, 13 Jan 2004 15:34:10 -0000, "One Handed Man [ OHM# ]"
<O_H_M{at}BTInternet{dot}com> wrote:
First of all set your forms KeyPreview property to True, then trap the
KeyDown or KeyUp events and find out.
Regards - OHM

Tom wrote:
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


Nov 20 '05 #3

P: n/a
I misread it, I thought he wanted it trapped anywhere on the form.

lostdreamz wrote:
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

On Tue, 13 Jan 2004 15:34:10 -0000, "One Handed Man [ OHM# ]"
<O_H_M{at}BTInternet{dot}com> wrote:
First of all set your forms KeyPreview property to True, then trap
the KeyDown or KeyUp events and find out.
Regards - OHM

Tom wrote:
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


--
Best Regards - OHM

O_H_M{at}BTInternet{dot}com
Nov 20 '05 #4

P: n/a
* lostdreamz <yb***********@ubgznvy.pbz> scripsit:
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
///

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.