![Pressing keys opens programs](https://cdn-ak.f.st-hatena.com/images/fotolife/g/greathigh-power/20200126/20200126193949.jpg)
![pressing keys opens programs pressing keys opens programs](https://venturebeat.com/wp-content/uploads/2020/04/IMG_2974D-e1587156102321.jpeg)
The KeyPress event is not raised by non-character keys other than space and backspace however, the non-character keys do raise the KeyDown and KeyUp events. If (Control::ModifierKeys = Keys::Shift) " + vbCrLf)
![pressing keys opens programs pressing keys opens programs](https://atnsoft.com/keymanager/images/keymanager_launch_program.png)
If shift key was pressed, it's not a number. Set the flag to true and evaluate in KeyPress event. A non-numerical keystroke was pressed. Determine whether the keystroke is a backspace. Determine whether the keystroke is a number from the keypad. Determine whether the keystroke is a number from the top of the keyboard. Void textBox1_KeyDown( Object^ /*sender*/, System::Windows::Forms::KeyEventArgs^ e ) Handle the KeyDown event to determine the type of character entered into the control. Boolean flag used to determine when a character other than a number is entered. The following code example uses the KeyPress event to prevent characters from entering the control. public:Įvent System::Windows::Forms::KeyPressEventHandler ^ KeyPress public event KeyPress member this.KeyPress : Public Custom Event KeyPress As KeyPressEventHandler Event Type KeyPressEventHandler Examples space or backspace key is pressed while the control has focus.
![Pressing keys opens programs](https://cdn-ak.f.st-hatena.com/images/fotolife/g/greathigh-power/20200126/20200126193949.jpg)