1 private void txtKaisuu_KeyPress(object sender, KeyPressEventArgs e) 2 { 3 if ((e.KeyChar >= 32 && e.KeyChar <= 47) || (e.KeyChar >= 58 && e.KeyChar <= 126)) 4 { 5 e.Handled = true; 6 } 7 else 8 { 9 e.Handled = false; 10 } 11 }