473,652 Members | 3,162 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Capturing control keys

Hi

How can I capture control keys Ctrl-A, Ctrl-B, Ctrl-C etc. in a form?

Thanks

Regards
Jun 27 '08 #1
2 3094
On Apr 21, 12:01 am, "John" <i...@nospam.in fovis.co.ukwrot e:
Hi

How can I capture control keys Ctrl-A, Ctrl-B, Ctrl-C etc. in a form?

Thanks

Regards
John,
First set keypreview property of your form to "True", then:

Private Sub Form1_keydown(B yVal sender As System.Object, ByVal e As
System.Windows. Forms.KeyEventA rgs) Handles MyBase.KeyDown
If e.KeyData = Keys.Control + Keys.A Then
MsgBox("Ctrl+A pressed")
ElseIf e.KeyData = Keys.Control + Keys.B Then
MsgBox("Ctrl+B pressed")
ElseIf e.KeyData = Keys.Control + Keys.C Then
MsgBox("Ctrl+C pressed")
End If

Hope this helps,

Onur Güzel
End Sub
Jun 27 '08 #2
\\\
Private Sub Form1_KeyUp(ByV al sender As Object, _
ByVal e As System.Windows. Forms.KeyEventA rgs)
Handles Me.KeyUp
Dim i = e.KeyData
End Sub
///

Cor

"John" <in**@nospam.in fovis.co.ukschr eef in bericht
news:%2******** ********@TK2MSF TNGP04.phx.gbl. ..
Hi

How can I capture control keys Ctrl-A, Ctrl-B, Ctrl-C etc. in a form?

Thanks

Regards
Jun 27 '08 #3

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

Similar topics

4
15351
by: Vazz | last post by:
I am trying to capture the key combination "Control + Shift + Enter" in a KeyDown event. I am able capture "Control + Enter" using (e.KeyCode == Keys.Enter && e.Modifiers == Keys.Control). How do I check if there are two Modifiers?
0
1138
by: veena | last post by:
hello, i have got a problem of how to capture two keys when pressed together i.e in my task i require certain action to be performed when the ctrl and 'A' keys are pressed together i.e i need to perform some action when entire text is selected. how can i approach this problem of capturing the combined keys pressed any help is appreciated. regards
2
2350
by: JPSutor | last post by:
I need to capture multiple keys with the keyUp event (Ex. Tab + 7) I can captuee individual keys by I'm not sure how to caputre multiple keys
2
6075
by: Phil Galey | last post by:
I'm using the ProcessCmdKey event to capture various keys that are pressed. However, I'm having trouble capturing the combination of the CTRL key and, say, the DOWN key. If I just press the CTRL key alone, the KeyData value is 131089. But all the possibilities I'm finding in the Keys enumeration are the following: Keys.ControlKey = 17 Keys.Control = 131072 Keys.LControlKey = 162 Keys.RControlKey = 163
2
2613
by: Sagaert Johan | last post by:
Hi I have a usercontrol , the keypress and keyup/down events do not seem to work on the cursor keys . How can i capture the cursor keys when my control has the focus ? Johan
3
5246
by: MLM450 | last post by:
I have a control that handles the KeyDown event but it does not seem to execute when a combination of keys is pressed - like CTRL+Z. If I press CTRL, it executes. If I press Z, it executes. But the handler does not see the combination. Now this control is contained within another control which is contained within another. The top most control does see the CTRL+Z. I can easily pass down the key info, but why does the nested control see...
2
4245
by: senfo | last post by:
Hello all, To help alleviate human error, I'm developing an application that uses a barcode reader to fill in a value in a TextBox control. The barcode reader is connected to the PC through the PS2 keyboard jack, so to Windows, it's essentially just a keyboard. After the reader has finished reading the barcode, it sends out Ctrl + M (which I *think* is a carriage return). To capture the Ctrl + M, I configured an event handler for the
2
4765
by: =?Utf-8?B?SmVzcGVyLCBEZW5tYXJr?= | last post by:
I have a tabcontrol where I want to capture the CTRL+C key combination. My tabcontrol has on its tabpages some treeView controls. My intention is to intercept the event of pressing the CTRL+C when one of the controls embedded in the tabControl has the focus. I'm doing this using the KeyDown event. However, when pressing the CTRL+C my computer sounds a beep - as in 'not allowed' beep. The capturing of the keycombination works fine, however,...
6
4569
by: mbewers1 | last post by:
I've never handled keysroke events before and I would like to implement a Return keystroke event in a Windows form to bring up a list of items in a datagrid as well as habing a search button in the form. With the help of a tutorial, I have coded the following event: private void ReturnResults(object o, KeyPressEventArgs e) { char c = e.KeyChar; if (c == (char) Keys.Return) {
0
8367
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
8279
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
8811
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8703
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
8467
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
8589
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
6160
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...
1
1914
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1591
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.