473,666 Members | 2,250 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 4578
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}BTInte rnet{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.M odifierKeys = 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}BTInt ernet{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.M odifierKeys = 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}BTInt ernet{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}BTInte rnet{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.M odifierKeys = Keys.Control Then


Better:

\\\
If (Control.Modifi erKeys 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
12174
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 exit Python, rather than giving the ridiculous msg Use Ctrl-D (i.e. EOF) to exit. The additional reason is that God intended Ctrl-D to be "scroll down", as in vi. I have my keyboard translator set up to do something very much like that...
4
13973
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 this socket just like you would enter things on the keyboard if you telneted to this server). In a normal telnet session you can enter some commands which take a long time to complete, and they run in the background and you get the command line...
10
23525
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 VB, I can set keyascii=0 to kill the input. Is there a similar way to do it in JavaScript? Thanks a lot. <HTML><head></head><body> <form name="myForm"> Password: <input type="text"><br> Comfirm: <input type="text" name="myText"
13
9427
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 intercept the key so that I can do stuff on the server side to make the new window behave correctly? (We have a JSP-based webapp which stores state in the session. Now if two windows access (and modify!) the same session, then madness will result....
5
5913
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 disable Ctrl-Alt-Delete. It seems there seems to be only one real way I know about: Write a replacement Gina Driver to eat the keyboard events I dont want. Does anyone have a good template for this in Visual Basic .Net?
3
4958
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 tons of examples of capturing keys in IE but *none* of them work for capturing Ctrl+S, Ctrl+F, Ctrl+P,etc or any key combination that has a binding in IE. Does anyone know how to do this?
3
7104
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 which hotkey was pressed? Secondly I am trying to replicate the Ctrl-Tab functionality you have in the DotNet IDE when you hold down the Ctrl key and then additional use the tab key you can cycle thru the MDI Children. I would like to gain the...
2
8640
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 other subprocess modules) and how can i pass Ctrl-C to this program to terminate it in python? thanks
11
2248
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 + Space and that does work, but Ctrl + Space does not. I removed Ctrl + Space thinking re-adding it might help, but now the
21
7184
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 I actually contemplated that I must have accidentally changed it to this myself, but I don't see how that could have possibly happened. Where can I / should I report this? It doesn't exist in Visual C# .NET, so it's not generic to VS .NET.
0
8454
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8362
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,...
0
8785
jinu1996
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...
1
8560
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,...
0
8644
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 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...
0
7389
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5671
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
2776
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 we have to send another system
2
1778
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 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...

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.