enter key and botton click

  • Thread starter Thread starter leanne
  • Start date Start date
L

leanne

I would like at a text box hit enter key will act like a
botton click. But the following code doesn't work. Need
help.
Private Sub txtbox_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Call btnOK_Click
KeyAscii = 0
End If

End Sub

Leanne
 
Back
Top