This code does not work. I press on any characters, the program does not close.

private void textBox2_KeyDown_1(object sender, KeyEventArgs e) { if (!(e.KeyCode >= 0 && e.KeyCode <= 9)) { // Display a pop-up Help topic to assist the user. this.Close(); } } 
  • 2
    Did not try to use Keys ? - Specter
  • So I do, guys. Pressing F1, Shift, and the like work. And my example is not. - fiera

1 answer 1

if (!(e.KeyCode >= Keys.D0 && e.KeyCode <= Keys.D9))

  • Thank you, kitty! How can you give out the benefits? I have been here recently. - fiera