simple post for explaining how to catch the Enter button press when, for example, we are writing in a textbox:First step
add to the textbox KeyDown event :
AddHandler txtBox.KeyDown, AddressOf checkKey
Second step
control the key, the keydown event expects an argument with KeyEventArgs, which among other things provides that we will use the KeyCode:
Private Sub checkKey(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs)
If e.KeyCode = Keys.Enter Then
.....
End If
End Sub
0 commenti:
Posta un commento