'Declaration Public Event Validating As ValidatingHandler
public event ValidatingHandler Validating
The event handler receives an argument of type ValidatingEventArgs containing data related to this event. The following ValidatingEventArgs properties provide information specific to this event.
Property | Description |
---|---|
Control | Returns the control whose value is being validated, or null if the entity being validated is not a control. |
Editor | Returns the Editor whose value is being validated, or null if the entity being validated is not an embeddable editor. |
IsValid | Gets/sets a boolean value indicating whether the Value has passed validation. |
Status | Returns the ValidationStatus constant which describes whether the validation failed and if so, the reason it failed. |
ValidationSettings | Returns the ValidationSettings instance with which the validation session is associated. |
ValidationTrigger | Returns the ValidationTrigger constant which describes what action initiated the validation session. |
Value | Returns the value being validated. |
When the leaves a control/editor, or changes its value while it has focus, a validation session can be initiated, depending on the value of the ValidationTrigger property. When validation occurs, the validation criteria as defined by the ValidationSettings object associated with the control/editor being validated is evaluated. Whether the validation succeeds or fails, the Validating event fires immediately upon determining whether the value is valid. Any listener of the event can override the internal outcome of the validation by setting the IsValid property of the event arguments. When execution retruns from the Validating event, if the IsValid property is set to false, the ValidationError event is fired.
In the case where a validation session could potentially involve more than one control (as is the case when the Validate method is called), the Validating event fires once for each control being validated. The ValidationError event, by contrast, only fires once.
Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2