Thursday, May 15, 2008

There are two textboxes on a form, and the user types the letter "a" into one of the textboxes. If the form's KeyPreview property is set to True, will

TextBox control's KeyPress event fire?

Yes, the KeyPreview property value will cause the form's KeyPress event to fire
first, and the TextBox control's KeyPress event will fire next. By default, the
form's KeyPreview property is False, causing the TextBox's KeyPress event to
fire first. Using the form's KeyPreview property, you can implement form-level validation.
This is particularly useful if you need to monitor user input regardless of which
control on the form has focus.

Your Title