Visual Basic Reference

Validate Event

See Also    Example    Applies To

Occurs before the focus shifts to a (second) control that has its CausesValidation property set to True.

Syntax

Private Sub object_Validate(KeepFocusAs Boolean)

The Validate event syntax has these parts:

Part Description
object An object expression that evaluates to an object in the Applies To list.
KeepFocus Value that determines if the control loses focus. Setting KeepFocus to True specifies that the control retains the focus.

Remarks

The Validate event works in tandem with the CausesValidation property to prevent a control from losing the focus until certain criteria are met.

Important   The Validate event only occurs when the control which is about to receive the focus has its CausesValidation property set to True.