Hey what's up.
Oh no that's wrong. You can't do it that way.
When the Form's keydown event get's executed is each time there is a key pressed down.
When the key/character is pressed down on the keyboard the event is fired calling the form's event handler which sets the label1.text property to whatever the character is pressed down to.
If you would like it to accumulate all the previous state then you would need to do label1.tex += e.KeyData.ToString();
And if for this to work you would need the form to have focus when the keydown event occurs.
Here is what you are looking for:
To handle keyboard events only at the form level and not allow other controls to receive keyboard events, set the KeyPressEventArgs.Handled property in your form's KeyPress event-handling method to true. Certain keys, such as the TAB, RETURN, ESCAPE, and arrow keys are handled by controls automatically. In order to have these keys raise the KeyDown event, you must override the IsInputKey method in each control on your form. The code for the override of the IsInputKey would need to determine if one of the special keys is pressed and return a value of true.
RAyRAy
Huh O i C
RAyRAy
Huh O i C
Program or Be Programmed!!!
|