473,509 Members | 2,951 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ctrl-click

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
4 4566
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
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
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
* 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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
12157
by: Mike Maxwell | last post by:
<vent> I see there has been traffic over the years on this gripe, so just let me vent my frustration, and add another reason why 'exit' (or possibly exit() or quit() or halt() or some such) should...
4
13942
by: Scott | last post by:
I am using a TCPIP connection to communicate over port 23 (telnet) to a server, and I am having to mimic normal command line interface you owuld see in a telnet session (i.e. I have to write to...
10
23486
by: chirs | last post by:
I have a code to disable ctrl-v (paste) on the 2nd box. The problem is that when I type ctrl-v, the text shows, then disappear after I release ctrl-v. How can I make it not to show in the box. In...
13
9402
by: Kai Grossjohann | last post by:
It seems that Ctrl-N in Mozilla opens a new empty browser window. That's fine, I don't need to do anything about it. But Ctrl-N in IE appears to clone the current window. Is there a way to...
5
5893
by: Greg | last post by:
I am developing an application where I need to secure a workstation for periods of time. I can use BlockInput to stop users from task switching or messing with the keyboard, but I would like to...
3
4946
by: Greg | last post by:
I want to be able to capture the user pressing Ctrl+S. I know that the IE browser has a key binding for Ctrl+S but is there any way that I can be notified of this key press anyway. I have found...
3
7078
by: Glen Hong | last post by:
I have set up a hotkey using RegisterHotKey API function for Ctrl-Tab. Firstly, I can rap this when Ctrl-Tab is pressed however if I want to add an addition hotkey how can I distinguish between...
2
8619
by: s99999999s2003 | last post by:
hi i have a program that works very similar to tail -f in Unix It will need a Ctrl-C in order to break out of the program. I wish to run this program using python (either thru os.system() or some...
11
2235
by: Bookham Measures | last post by:
Hello As above, my Ctrl + Spacebar for intellisense is not working in VI 6.0. I have checked keyboard assignments and Ctrl + Space is listed for Edit -> CompleteWord. I added Ctrl + Shift +...
21
7163
by: Zytan | last post by:
Instead of Ctrl+Y redoing what's stored in 'future history', it REPLACES that information (which will then be forever lost) with a new command: delete current line. This shortcut is so ridiculous...
0
7237
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7137
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...
0
7506
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...
0
5656
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5062
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...
0
3207
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1571
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 ...
1
779
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
443
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...

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.