Detecting Enter KeyPress on VB.NET 2008

Posted by Tareq on Stack Overflow See other posts from Stack Overflow or by Tareq
Published on 2010-05-02T04:15:08Z Indexed on 2010/05/02 4:27 UTC
Read the original article Hit count: 228

Filed under:

I am using 3.5 framework of VB.NET 2008.

I have some textboxes in my form. I want the tab like behavior when my user presses ENTER on one of my textboxes. I used the following Code:

Private Sub txtDiscount_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtDiscount.KeyPress
    If e.KeyChar = Microsoft.VisualBasic.ChrW(Keys.Return) Then
        SendKeys.Send("{TAB}")
        e.Handled = True
    End If
End Sub  

But It doen't work for me.

Please give me a solution.

© Stack Overflow or respective owner

Related posts about vb.net