OnKeyPress and KeyPress
-
Hy Can anybody tell me what is the difference between KeyPress event and OnKeyPress override? Why we need both? Why don't work in the same time, only one run? thx
The KeyPress event can be used by the associated class or other classes. For example, a Form can listen for key pressed on a TextBox that it contains. The OnKeyPress method is used to fire the KeyPress event. This can only be used by dervied types. So if you create a custom TextBox (say MyTextBox), then you can override the OnKeyPress to catch key presses, alter when the KeyPress event is fired, fire another event, etc.
Take care, Tom ----------------------------------------------- Check out my blog at http://tjoe.wordpress.com
-
Hy Can anybody tell me what is the difference between KeyPress event and OnKeyPress override? Why we need both? Why don't work in the same time, only one run? thx