Yes, of course it is possible. You can add a validation event handler that validates a character. You may have a dictionary of valid characters, or if you restrict a character to a specific encoding (possibly UTF-8), you can compare a character with a range of characters using < and > .
More specifically: you can handle the KeyPress event. If e.KeyChar invalid, set e.Handled to true .
Try the following:
private void textBox_KeyPress(object sender, KeyPressEventArgs e) { if (System.Text.Encoding.UTF8.GetByteCount(new char[] { e.KeyChar }) > 1) { e.Handled = true; } }
Reinderien
source share