473,320 Members | 1,612 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

shortcut keys

How can I add a shortcut key to a button in a windows app.?
for example
i have a button called submit and right now the only way to execute
its function is to left click the button. I would like to add a
shortcut key that correspond to this action. ctrl+s
quesitons no.2
how come when i hit the enter key in a windows control text input
field it doesn't submit? it will only submit if i click the submit
button. is there a command i missed? (I hope this makes sense)

thanks

Kuya
Nov 15 '05 #1
1 2806
Aaron <ku*****@yahoo.com> wrote in message
news:b4**************************@posting.google.c om...
How can I add a shortcut key to a button in a windows app.?
for example
i have a button called submit and right now the only way to execute
its function is to left click the button. I would like to add a
shortcut key that correspond to this action. ctrl+s


Add an event handler to key-pressing of the button, within your Form class:

private void button1_KeyPress(object sender,
System.Windows.Forms.KeyPressEventArgs e)
{
/* If Esc key pressed, for example */
if (e.KeyChar == (char) 27)
{
MessageBox.Show("Esc pressed!!!");
}
}
Nov 15 '05 #2

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

Similar topics

4
by: The Flyer | last post by:
Hi Sorry for posting this message to so many groups, but I was not sure which group the windows keyboard experts would be reading, so I ventured to post it to all of them. I want to map or...
4
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...
0
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,...
2
by: Jim S | last post by:
I am having a problem finding information regarding vb.net allowing you to create shortcut keys for buttons using the CTRL key + function buttons such as F1, F2 etc.. (Ex: Press CTRL+F1 to activate...
0
by: TCook | last post by:
Hello All, First, I apologize for posting this to so many newsgroups but I wasn't sure which newsgroup was most appropriate nor which newsgroup would most likely have subscribers that have done...
2
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...
1
by: Emma Middlebrook | last post by:
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...
0
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)..
1
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...
1
by: scudsong | last post by:
I override ProcessCmdKey() in my MDI parent form class and have some keyboard shortcut calling method in same class. But I wish to make these hotkeys working in parent/child form and other form. The...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.