Solved

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

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

Stressed Out?

Watch some penguins on the livecam!

Question has a verified solution.

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

If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

690 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