问题
I would like to equal a click on Button1 to press the Enter key on the keyboard, how can I do that? Can you provide me the code please? Thanks in advance..
回答1:
Set the AcceptButton
property of your form to be Button1
Documentation here
回答2:
I belive this is what he's looking for:
Private Sub Button1_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Button1.Click
SendKeys.Send("{ENTER}")
End Sub
As I understand it he wanted a button to press Enter for him, not that the button would be activated when pressing Enter.
来源:https://stackoverflow.com/questions/24261654/button-click-equals-to-press-enter-key-on-the-keyboard