1 private void txtTestPerson_KeyPress(object sender, KeyPressEventArgs e) 2 { 3 4 if ((e.KeyChar >= 'a' && e.KeyChar <= 'z') || (e.KeyChar >= 'A' && e.KeyChar <= 'Z') || e.KeyChar == '') 5 { 6 e.Handled = false; 7 } 8 else 9 { 10 e.Handled = true; 11 } 12 }
