Kyepreview with combo box...

  • Thread starter Thread starter Ansari
  • Start date Start date
A

Ansari

Hi All,

I have a simple requriement... I want then whenever a user press enter on a
form in moves to next control... For that purpose I wrote following code in
Form's KeyDown event and sets Form's Keypreview property to true...

Private Sub frmBHEntry_KeyDown(ByVal sender As Object, ByVal e As
System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyDown

If e.KeyCode = Keys.Enter Then
SendKeys.Send("{Tab}")
End If

End Sub

It work fine for textboxes and other controls but It does not work for combo
box control... Why???

Thanks in advance

Ansari
 
I know that this isn't the answer you're looking for, but I feel
compelled to ask why you're making your application act this way?

Your app will work differently from every other application on a
Windows platform, and different from browser forms on the Web. Won't
that confuse your users, when they find that the Enter key does
something different in your application?
 
Back
Top