Change events (of TextBoxes, for instance) or Click events (e.g.
for OptionButtons, CheckBoxes, ComboBoxes, and ListBoxes) happen on many standard
VB controls whenever control contents changes for any reason, including:
Changes caused by user input;
Changes caused by program code or system
Changes that happen in the underlying
data of a bound control.
These events are most useful
when you need to constantly monitor the overall
state of data validity on the form, perhaps
because you wish to decide whether particular
controls (such as an OK button) should be enabled.
In order to implement this type of behavior,
you should write a general validation routine
that checks the validity of the entire form
and then call it from the appropriate Click
or Change event procedures.
The Change event is less useful for keystroke validation, due
to the fact that it fires so often (every time even a single character changes)
but has no built-in way to cancel changes. You should leave keystroke validation
to the KeyPress, KeyUp, and KeyDown event procedures, as described in previous
sections of this chapter.
Related topics on Field-Level Validation Techniques