473,387 Members | 1,757 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,387 software developers and data experts.

How do you Capture Keyboard shortcuts

I have a listBox on my form. When the listBox has focus I want to respond
to certain keyboard shortcuts like Ctrl+A that is used to select all
contents as in Word, but I want to apply this to the Items collection of the
listBox.

I am not exactly sure how I can go about this.... I suspect I would add
code to the KeyPress event of the listBox, but that is about as far as I
have gotten so far.

The EventArguments e will have the data, but I don't know what objects I
will need to create, etc.

Can somebody give me guidance?
Sep 17 '06 #1
1 1776
I am trying something like this, but as you will see, I am missing some code
private void lbSelectedScripts_KeyPress(object sender, KeyPressEventArgs e)

{

if (e.KeyChar == Keys.Crsel)//Not sure this is the right key for Ctrl+A

{

foreach (object item in lbSelectedScripts.Items)

{ // need to figure out what to do here to select all items

}

}
}
Sep 17 '06 #2

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

Similar topics

1
by: Spartanicus | last post by:
Some use the kbd element (Example: <kbd>Ctrl</kbd>+<kbd>G</kbd>) to mark up keyboard shortcuts, but the spec defines kbd as: "Indicates *text* to be entered by the user." (emphasis mine). UA...
0
by: ekta | last post by:
How do we write the code for Keyboard shortcuts in asp.net(c#).Is it possible through javascript only or there is any method/property availaible (like Accesskey) in asp.net. Thanks
5
by: bob lambert | last post by:
Hi, I have a vb .net std 2002 windows form app and wanted to use keyboard shortcuts (& in text property input) It shows up on the design view, but when I build (in debug mode) and display the...
4
by: Helene Day | last post by:
Sorry, this could be a newby question... but how do we do the keyboard shortcuts in .NET buttonname.text = "&Click Me" Does not give the short cut Alt-C for the button. Helene
0
by: Mishaev Mark | last post by:
Hi all, How can I disable the standard keyboard shortcuts that are automatically processed by Visio (Ctrl-D for example)? I've tried to use KeyUp event to set "CancelDefault" property to...
1
by: Erland | last post by:
Hello, I am using asp.net 2.0 and I want to add keyboard shortcuts to my application just like the shortcuts you see in GMAIL. I was wondering how can I do this in ASP.NET? Scenerio that would...
0
by: Zytan | last post by:
I cannot use & to implement a keyboard shortcut on a TabPage like I can on a Button. Is there a way to easily do this? Maybe TabPages aren't supposed to have keyboard shortcuts, but it would be...
331
by: Xah Lee | last post by:
http://xahlee.org/emacs/modernization.html ] The Modernization of Emacs ---------------------------------------- THE PROBLEM Emacs is a great editor. It is perhaps the most powerful and...
1
by: Gilbert Tordeur | last post by:
Hello, Context = Web site with VB2008. Is it possible to define keyboard shortcuts on a webpage, to make it possible for the user to "click" on a button or a link, or to set the focus on a...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
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...
0
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,...

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.