C#: How to make pressing enter in a text box trigger a button, yet still allow shortcuts such as “Ctrl+A” to get through?

后端 未结 5 1104
抹茶落季
抹茶落季 2021-02-03 22:01

Sorry for the long title, but I couldn\'t think of another way to put it.

I have this:

    private void textBoxToSubmit_KeyDown(object sender, KeyEventAr         


        
5条回答
  •  你的背包
    2021-02-03 22:33

    Can you not use AcceptButton in for the Forms Properties Window? This sets the default behaviour for the Enter key press, but you are still able to use other shortcuts.

提交回复
热议问题