[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Visual Studio 2008 - Key up Event in List Box

Posted on 2011-09-07
4
Medium Priority
?
266 Views
Last Modified: 2012-05-12
Private Sub LBoxSavedReports_KeyUp(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles LBoxSavedReports.KeyUp

I have the above key up event for a Listbox.  It appears to ignore the event.  I placed a stop in the code but it does not stop nor does the code run.  It appears to ignore the code.  I'm not clear what has caused the code to be ignored.
0
Comment
Question by:dastaub
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 40
ID: 36500418
I do not have VS2008 available anymore, there might be a bug that I missed while working in that version (such as the DoubleClick that never fired on a ComboBox in VS2002). In VS2010, it works not matter the key.

A few ideas.

Is this for any key, or for a given key?

Is the ListBox Enabled property set to True?

This one is obvious, but sometimes we do those strange mistakes when debugging. Is the cursor in the ListBox when you release the key?

Sometimes, changing the value of a property has indirect impact somewhere. The properties that are in bold in the Properties window are those that are not set to their default. One by one, reset them to the default with a Right click on the property name (some properties cannot be reset, but those should not be the cause of your problem). You might find one that has an indirect impact on the KeyUp.

If you do not find the cause of the problem, tell us what you want to do on the KeyUp. There might be an alternative.



0
 

Author Comment

by:dastaub
ID: 36500779
Tell us what you want to do on the KeyUp. There might be an alternative.

i use the "DEL" key to delete the highlighted row in the listbox  The right-click is already used.
0
 
LVL 40

Accepted Solution

by:
Jacques Bourgeois (James Burger) earned 2000 total points
ID: 36503923
Strange, Del is catched, I have just checked. So there is definitively something wrong in the application, such as a stray property interaction somewhere.

Does KeyDown receives the key?

If yes, then there is something in between the 2 events that grabs the key. Stop in KeyDown and trace the code with F11 (or Shift-F8, depending on how you configured your environment).

Or trap Del at the form level. In order to do so, you must first set the KeyPreview property of the form to True. This will send the key to the form KeyUp event before sending it to any control. Once again you might try to trace from there to see what could prevent the key from going out to the ListBox.

If not, here are a few alternatives.

Maybe a small button beside the listbox? Does not have to be big or have Delete ou Détruire on it, a simple X or trash can icon is usually sufficient for the user to understant its use.

Or, trap Del at the form level, and have code such as the following:
If ListBox1.Focused Then
   'Do your stuff
End If

Open in new window

0
 

Author Comment

by:dastaub
ID: 36508347
it turned out to be the listbox was losing focus due to other code in the project.  I was able to find this by using your suggestion of a keypreview for the form.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

IP addresses can be stored in a database in any of several ways.  These ways may vary based on the volume of the data.  I was dealing with quite a large amount of data for user authentication purpose, and needed a way to minimize the storage.   …
More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question