This is my code:
private void txtAdd_KeyPress(object sender, KeyPressEventArgs e) { if (!(char.IsLetter(e.KeyChar)) && !(char.IsNumber(e.KeyChar)
private void Keypressusername(object sender, KeyPressEventArgs e) { e.Handled = !(char.IsLetter(e.KeyChar)); if (char.IsControl(e.KeyChar)) { e.Handled = !(char.IsControl(e.KeyChar)); } if (char.IsWhiteSpace(e.KeyChar)) { e.Handled = !(char.IsWhiteSpace(e.KeyChar)); } }