How can I accept the backspace key in the keypress event?

后端 未结 8 608
长情又很酷
长情又很酷 2020-12-16 10:39

This is my code:

private void txtAdd_KeyPress(object sender, KeyPressEventArgs e)
{
    if (!(char.IsLetter(e.KeyChar)) && !(char.IsNumber(e.KeyChar)         


        
8条回答
  •  青春惊慌失措
    2020-12-16 11:26

    From the documentation:

    The KeyPress event is not raised by noncharacter keys; however, the noncharacter keys do raise the KeyDown and KeyUp events.

提交回复
热议问题