这是我的代码:
private void txtAdd_KeyPress(object sender, KeyPressEventArgs e)
{
if (!(char.IsLetter(e.KeyChar)) && !(char.IsNumber(e.KeyChar)) && !(char.IsWhiteSpace(e.KeyChar)))
{
e.Handled = true;
}
}
它允许我输入字母、数字和空格,但不允许我进行退格。请帮我。