1private void textBoxX_KeyPress(object sender, KeyPressEventArgs e) 2 { 3 if (!(Char.IsLetter(e.KeyChar) || Char.IsDigit(e.KeyChar) || Char.IsControl(e.KeyChar))) 4 e.Handled = true; 5 }