473,554 Members | 3,119 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Dialog Handling Shortcut keys

Hi there,

I'm trying to handle some shortcut keys within my application and I
can't seem to get the code to work when you are trying to action
against a ctrl + other character.

I found a post
http://groups.google.co.uk/group/mic...cbc8062c107680
that appears to help a lot but it doesn't seem to work with the ctrl
key.

here's the snippet of code I am working with, which was modified from
the thread mentioned above:

protected override bool ProcessDialogKe y(Keys keyData)
{
if (keyData == Keys.ControlKey && keyData == Keys.G)
{
ReassignAssessm ent();
}
else if (keyData == Keys.Insert)
{
ToggleReadUnrea d();
}

return base.ProcessDia logKey(keyData) ;
}

This method seems to be fired on every key press, so I don't even get
a chance to press "G" as the method has already fired on ctrl. Even
when I run without debugging it's showing no signs of executing.

The value of keydata when I do debug is 131089, which if I look at the
MSDN help could match to the value of Keys.Control (131072) +
Keys.ControlKey (17)

Are there any alternatives that I could try to get this to work?

Thanks,

Emma Middlebrook

May 24 '07 #1
1 2896
On May 24, 1:54 pm, Emma Middlebrook <e.middlebr...@ googlemail.com>
wrote:
This method seems to be fired on every key press, so I don't even get
a chance to press "G" as the method has already fired on ctrl. Even
when I run without debugging it's showing no signs of executing.
You need to use:

if (keyData == (Keys.G | Keys.Control))
{
....
}

This will trigger if G and Ctrl are pressed, but won't trigger on:
Shift+G
G
Shift
Ctrl
Ctrl+Shift+G
Alt+G
etc

Jon

May 24 '07 #2

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

Similar topics

4
3330
by: Maurice Mertens | last post by:
Hi, I'm trying to set shortcut keys for textboxes. But what is the best way to do this in VB.NET. In Access it was very simple, just put an "&" sign in the label that belongs to the textbox. But in VB.NET it looks like you have to program code for the shortcut keys. Like putting this code in the Form_KeyUp: If e.Alt And e.KeyCode =...
0
1733
by: Saper\(ek\) | last post by:
this is a strange behavior of buttons with shortcut keys, when You have a datagrid on a form and some buttons with shortcut keys. When You click on the datagrid (anywhere but the cells, free space, header or something) and press the shortcut key (without the ALT key pressed) button's action is called. You can easyli recreate this by...
9
1742
by: Lars Netzel | last post by:
If I press the Key "a" on the keyboard, all the events and properites will only give me "65" as keycode.. and I want it to give me "a". If I use the KeyPress event.. then I will have access to e.KeyChar which will give me the "a" but I can't use that here.. I need to use the KeyDown.. since you can only capture ONE key in KeyPress and I'm...
2
11719
by: philelpko | last post by:
Morning all, My database is now secure and hosted on the network and appears to be happily running thanks to several (hundred) posts on this site so thanks to everyone for the help. One person unfortunately did some final destructive testing for me which seem to consist of nothing more than hitting random keys on the keyboard. This, to my...
0
2640
by: thirunavukarasukm | last post by:
Hai... How to Usercontrols with Shortcut Keys... I am creating one windows apllication.. the apllication contain many form.. in one form i am used one usercontrol(parent control)..
3
1925
by: =?Utf-8?B?R3JlZw==?= | last post by:
I've been trying to figure out how to show a color dialog in VB.Net . I've come across the following code that shows it, but its not the advanced color dialog I am looking for. I know there is another way to show a color dialog box, but I can't seem to find it. Dim MyDialog As New ColorDialog() ' Keeps the user from selecting a custom...
1
1684
sujathaeeshan
by: sujathaeeshan | last post by:
Hi all, I need to provide shortcut keys for controls like text box and buttons etc... That is i dont want to go for tabspace or mouse click for perticular controls.. By having shortcut keys i need to go for specifeid controls(textbox,button)... Is there any way to provide shotcut keys for controls.....or built in property values..... ...
11
2341
by: VK | last post by:
In the continuation of the discussion at "Making Site Opaque -- This Strategy Feasible?" and my comment at http://groups.google.com/group/comp.lang.javascript/msg/b515a4408680e8e2 I have realized that despite suggestions to use DHTML-based modal dialogs are very common? there is not a single fully functional reliable copyright-free...
8
5285
by: BD | last post by:
How can I duplicate the behavior of the operating system shortcut keys in my application? For example, my windows form has 5 controls (textboxes), the operating system will pickup which control has the focus and handle ctrl-c, ctrl-v, or any other shortcuts. I have the same shortcuts working in my app, but have not determined how to find...
0
7589
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...
0
7787
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. ...
0
8029
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...
0
6131
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...
1
5428
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...
0
5147
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...
0
3550
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...
1
2012
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
0
831
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...

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.