Solved

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

Posted on 2009-06-27
2
1,638 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

920 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now