I hope you can accept an answer from a vb.net user.
private void TextBox1_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
{
if (char.IsLetter(Strings.ChrW(e.KeyCode)) | Information.IsNumeric(Strings.ChrW(e.KeyValue)) | char.IsControl(Strings.ChrW(e.KeyValue))) {
} else {
e.SuppressKeyPress = true;
}
}