简体   繁体   中英

Button Click Equals to Press Enter Key on the Keyboard

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..

Set the AcceptButton property of your form to be Button1

Documentation here

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM