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.

This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>