473,587 Members | 2,607 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to provide shortcut keys for controls like text box,button

sujathaeeshan
22 New Member
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(textbo x,button)...

Is there any way to provide shotcut keys for controls.....or built in property values.....


could any anoe help me out of this query...
Feb 16 '08 #1
16 25639
QVeen72
1,445 Recognized Expert Top Contributor
Hi,

For Buttons You can Change the Caption:

&Save

So, cmdsave_Click will be fired, when you press "Alt + S" on the form..

For TextBoxes, you have to code..

REgards
Veena
Feb 16 '08 #2
lotus18
866 Contributor
If you want the textbox or any control to be on focus, with an appropriate shortcut key and keypress event

Expand|Select|Wrap|Line Numbers
  1. <ControlName>.SetFocus
  2.  
Feb 16 '08 #3
mafaisal
142 New Member
Hello

Firstly Set Forms Property Keypreview True
Then Set All Controls in the Form have regular TAbIndex

Then in Form keydown event
Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
  2.  sendkeys vbtab
  3. End Sub
  4.  
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(textbo x,button)...

Is there any way to provide shotcut keys for controls.....or built in property values.....


could any anoe help me out of this query...
Feb 16 '08 #4
olseni
19 New Member
Hi all,
Sorry to "butt in" on this, but I have the same issue, and the answers so far does not seem to do the trick, or maybe I am doing it wrong....

If I have a form with a button called Open Details which opens another form. If I wish to use a shortcut key (instead of clicking the button with the mouse), e.g. Alt+O, how do I do that ? Is there functionality, or code to be used ?

Thanks
Best regards
Ingrid
Feb 28 '08 #5
kadghar
1,295 Recognized Expert Top Contributor
Hi all,
Sorry to "butt in" on this, but I have the same issue, and the answers so far does not seem to do the trick, or maybe I am doing it wrong....

If I have a form with a button called Open Details which opens another form. If I wish to use a shortcut key (instead of clicking the button with the mouse), e.g. Alt+O, how do I do that ? Is there functionality, or code to be used ?

Thanks
Best regards
Ingrid
Depending on the version you can use Veena's solution, but lotus' one is more general, add in the form's keypress event the code to call the click event's sub of the button, for example, something like this in te form keydown button will do:

Expand|Select|Wrap|Line Numbers
  1. If KeyCode = Asc("O") And Shift = 2 Then CommandButton1_Click
add it to the controls that can be selected, so when they're selected and you press Ctrl+O the command1_click sub will be called. It'll be some copypaste work if you have many commands, but is the simplest way for few.

Note 2 is the value of Ctrl. check the help file or the object browser to see the shift or alt values, you can also use vb constants.

HTH
Feb 28 '08 #6
Killer42
8,435 Recognized Expert Expert
Both people who have the problem, please tell us what version of VB you're using.
Feb 28 '08 #7
debasisdas
8,127 Recognized Expert Expert
If using VB 6.0 then it is quite easy to set focus for text boxes.

1.Use a label control for the labeling of the textbox .
2.UseMnemonic should be set to true for the label (default).
3.Use & to assign the Mnemonic.
4.Set the tab index of the textbox to one more than the corresponding label.

When you try set the focus on the label using the Mnemonic character and since label is a static control so could not receive the focus , focus will be set to next control in higher tab index order.
Feb 28 '08 #8
Killer42
8,435 Recognized Expert Expert
Thanks Debasis. Exactly what I would have said, if I'd had time. :)
Feb 28 '08 #9
sujathaeeshan
22 New Member
Hi,

Just provide the &Open Details at the text property of the button.
while running the form if u fired Alt+O ,it automatically fires the function of button(open details)-- which opens another form.

Regards
suji
Mar 2 '08 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

2
2143
by: Nick | last post by:
In VS 2003 and VS 2005 beta 2 I am trying to write a simple program. It has a datagrid and a textbox along with a menubar. There is a command in the menu bar which is "Run Query" and has the shortcut key of Ctrl + R If I am typing in my textbox and hit Ctrl + R an extra r character will show up in the textbox. I decided to then try this in...
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...
1
2819
by: Aaron | last post by:
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...
1
1626
by: BuddyWork | last post by:
Hello, If you copy the source code from this post into seperate files as stated, and compile the code. Now to reproduce run the code in debug. 1. Press the Client button. 2. Put the cursor on to the Textbox. 3. Press Alt-X and you will see nothing happens. Now press the Exit button and a message box will popup. Press ok.
5
3236
by: Shailja | last post by:
Hi, How to provide shortcut keys to toolbar button? If i write &New in caption property of button, which key should i use with N? Kindly let me know.
0
2642
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)..
4
6888
karthickbabu
by: karthickbabu | last post by:
Hi How can i create shortcut keys for Button Controls in vb.net. I am using MDI form and Child Form. I want to create shortcut key for button in ChildForm. Actually i created but when i press Alt it focus to MDI form Only. Whether its right or wrong Hoper your reply
1
1685
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..... ...
2
3001
by: Andrus | last post by:
If focused control is ReadOnly, menu shortcut key is ignored. To reproduce, run code below, press Ctrl+E. Note that message box does not appear. This issue blocks Ctrl+E usage in application. How to fix ? Andrus.
1
3018
by: =?Utf-8?B?UmF5IE1pdGNoZWxs?= | last post by:
Hello, I have a textbox containing a listview of items. I would like to set it up so that when that textbox has the focus and I press ctl-A from the keyboard it selects all the items. Dealing with the textbox and selecting the items is not the issue here since I can readily do that. However, how do I set everything up to know that ctl-A...
0
7918
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
7843
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...
0
8340
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
6621
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
5713
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
3840
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...
0
3875
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2353
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
1185
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.