Link to home
Start Free TrialLog in
Avatar of JiriNovotny
JiriNovotny

asked on

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

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

ASKER CERTIFIED SOLUTION
Avatar of Wayne Taylor (webtubbs)
Wayne Taylor (webtubbs)
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of JiriNovotny
JiriNovotny

ASKER

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.