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 1041
抹茶落季
抹茶落季 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:38

    https://stackoverflow.com/a/16350929/11860907

    If you add e.SuppressKeyPress = true; as shown in the answer in this link you will suppress the annoying ding sound that occurs.

提交回复
热议问题