I cannot seem to trap the Enter key in a text box. I there something I am doing wrong?
I tried the following:
Private Sub tbEdit_6_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles tbEdit_6.KeyPress
If Asc(e.KeyChar) = 13 Then
MsgBox("flag")
End If
End Sub
also:
Private Sub tbEdit_6_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles tbEdit_6.KeyDown
If e.KeyData = Keys.Enter Then
e.SuppressKeyPress = True
MsgBox("flag")
End If
End Sub
also:
Private Sub tbEdit_6_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles tbEdit_6.KeyDown
If e.KeyCode = Keys.Enter Then
MsgBox("flag")
End If
End Sub
I set it to true and it still did not work. I think there is something corrupted on my form. I created a new form and put in new text fields and they worked fine with the enter key. I didn't even have to set "AcceptsReturn true".