Solved

VB.NET: ListView KeyDown doesn't recognize the Enter(Return) key

Posted on 2009-06-27
2
1,656 Views
Last Modified: 2013-11-26
I have a form with a listview in VB.NET, the ListView is focused and the form property KeyPreview is set to true. No matter what, the Enter key is never recognized in the listviews KeyDown event. How to fix that?
Private Sub lvListView_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles lvListView.click
      
        If e.KeyCode = Keys.Enter Then
 
            Debug.Print("ENTER!!!")  'Never happens
 
        End If
        
    End Sub

Open in new window

0
Comment
Question by:JiriNovotny
2 Comments
 
LVL 47

Accepted Solution

by:
Wayne Taylor (webtubbs) earned 500 total points
ID: 24730337
Works fine for me. Are you saying there is nothing outputted to the immediate window?
0
 

Author Comment

by:JiriNovotny
ID: 24730348
I've figured it out. The form had AcceptButton set to a button that was not doing anything yet. Confused me :) Thanks for your help.
0

Featured Post

Space-Age Communications Transitions to DevOps

ViaSat, a global provider of satellite and wireless communications, securely connects businesses, governments, and organizations to the Internet. Learn how ViaSat’s Network Solutions Engineer, drove the transition from a traditional network support to a DevOps-centric model.

Question has a verified solution.

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

Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

839 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