F
Fred Sawtelle
I'm trying to trap the Enter key in any of the key events
(keypress, keydown, keyup) of the Windows .Net combobox
control. Try as I might, I cannot get the event to
respond to an Enter key press; nor can I find anything
documenting this situation. Help is appreciated.
Here's my code. This pops up a messagebox for normal
alphanumeric keys, but does nothing at all when Enter is
pressed.
Private Sub cboLoan_KeyDown(ByVal sender As Object, ByVal
e As System.Windows.Forms.KeyEventArgs) Handles
cboLoan.KeyDown
If e.KeyCode = Keys.Return Then
MessageBox.Show("KeyDown: got it")
End If
End Sub
Private Sub cboLoan_KeyPress(ByVal sender As Object,
ByVal e As System.Windows.Forms.KeyPressEventArgs)
Handles cboLoan.KeyPress
If e.KeyChar = ChrW(13) Then
MessageBox.Show("KeyPress: got it")
End If
End Sub
Private Sub cboLoan_KeyUp(ByVal sender As Object, ByVal e
As System.Windows.Forms.KeyEventArgs) Handles
cboLoan.KeyUp
If e.KeyCode = Keys.Return Then
MessageBox.Show("KeyUp: got it")
End If
End Sub
(keypress, keydown, keyup) of the Windows .Net combobox
control. Try as I might, I cannot get the event to
respond to an Enter key press; nor can I find anything
documenting this situation. Help is appreciated.
Here's my code. This pops up a messagebox for normal
alphanumeric keys, but does nothing at all when Enter is
pressed.
Private Sub cboLoan_KeyDown(ByVal sender As Object, ByVal
e As System.Windows.Forms.KeyEventArgs) Handles
cboLoan.KeyDown
If e.KeyCode = Keys.Return Then
MessageBox.Show("KeyDown: got it")
End If
End Sub
Private Sub cboLoan_KeyPress(ByVal sender As Object,
ByVal e As System.Windows.Forms.KeyPressEventArgs)
Handles cboLoan.KeyPress
If e.KeyChar = ChrW(13) Then
MessageBox.Show("KeyPress: got it")
End If
End Sub
Private Sub cboLoan_KeyUp(ByVal sender As Object, ByVal e
As System.Windows.Forms.KeyEventArgs) Handles
cboLoan.KeyUp
If e.KeyCode = Keys.Return Then
MessageBox.Show("KeyUp: got it")
End If
End Sub