Button Click Equals to Press Enter Key on the Keyboard

可紊 提交于 2019-12-23 06:36:46

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!