473,725 Members | 1,990 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How can I detect if the CTRL key is pressed when User click on a control ?

Hi,

A simple question : How can I detect if the CTRL key is pressed when User click on a control ?

Thanks,

Steph.
Jan 3 '06 #1
2 2492
Check the Control object's ModifierKeys (static) property, e.g.

if((Control.Mod ifierKeys & Keys.Shift) == Keys.Shift) {
// do something special
}
Marc

"Steph." <st***@nomail.c om> wrote in message
news:en******** *****@TK2MSFTNG P15.phx.gbl...
Hi,

A simple question : How can I detect if the CTRL key is pressed when User
click on a control ?

Thanks,

Steph.
Jan 3 '06 #2
Obviously, Keys.Control (not Keys.Shift) for your case! (clipboard
inheritence at work there folks, sorry...)

Marc

"Marc Gravell" <mg******@rm.co m> wrote in message
news:uH******** ******@tk2msftn gp13.phx.gbl...
Check the Control object's ModifierKeys (static) property, e.g.

if((Control.Mod ifierKeys & Keys.Shift) == Keys.Shift) {
// do something special
}
Marc

"Steph." <st***@nomail.c om> wrote in message
news:en******** *****@TK2MSFTNG P15.phx.gbl...
Hi,

A simple question : How can I detect if the CTRL key is pressed when User
click on a control ?

Thanks,

Steph.

Jan 3 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
3466
by: selowan | last post by:
Hi, In VB6 Pro SP5, I have a form that contains an MSFlexGrid and a few other textboxes and comboboxes. I am using the technique from MSDN article Q241355, which describes how to tab and edit in a flexgrid. Briefly, the technique is to overlay the cell to be edited with "floating" textbox; data is edited in the floating textbox and moved to the cell when the floating textbox loses focus. The technique works well except for when the...
6
7192
by: Rune | last post by:
Hey I'm trying to build a gui application and need to know if the user is actually holding down the shift or ctrl key. That is, if the user currently is holding down the shift key. In pseudo code this will boil down to something like this: def test: if user presses shift: return SHIFT_IS_PRESSED
1
20451
by: Scott Shaw | last post by:
Hi all, I was wondering if you could help out with this problem that I am having. What I am trying to do is detect keyboard input in a while loop without halting/pausing the loop until the key is pressed (without hitting return). I looked at serveral faq's on the net and installed the cspan readkey module and neither seems to work most likey its me since I am getting frustrated. but anyway here's a sample code. while (1) { if...
2
7017
by: Du | last post by:
How to tell if the Ctrl key is pressed without being inside a keypress/keyup/keydown event? I want distinguish between a "click" and a "ctrl+click" on a button. any suggestion? thanks
4
4585
by: Tom | last post by:
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
2
5044
by: Justin | last post by:
I'm creating a kiosk type application and this would be too simple for someone to figure out: Private Declare Function GetAsyncKeyState Lib "user32" ( ByVal vKey As Short) As Short Const VK_ESCAPE As Short = &H1B How can I upgrade this to detect multiple keystrokes? For example CRTL + E Any points in the right direction would be much appreciated. VB.NET 2005
17
7425
by: Kbalz | last post by:
I'm developing a Wizard type program, and I'm flipping between steps by using a TabControl.. buttons on each tabPage move to the next or previous tabPage. When I press CTRL+Tab however, the tabControl begins to cycle through the tabPages, just as it does in Visual Studio, IE7 etc.. any tabbed program. I need this blocked.
7
9579
by: =?Utf-8?B?QWxleCBLLg==?= | last post by:
Hi all When processing datagrid's MouseDown event, I need to know if Ctrl key is currently pressed. Is there any way to check this? It would help if I had keyUp and KeyDown events for Ctrl key ... Thank you
4
8496
by: vunet | last post by:
When user enlarges font with Ctrl+ I want to increase the dimensions of my fixed sized div. IE7 uses zoom-in, so it will increase div dimensions automatically. Firefox, however, increases font only, not div element. I thought to implementing this by checking if my div width or height changed and then resize it. But this approach did not work: div.addEventListener('resize', someFunc, false); Please advise. Thanks
0
8886
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
9255
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
9168
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
9104
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...
1
6701
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6010
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();...
0
4509
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4780
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2154
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.