Raises the Control.Validating event.
- e
- A System.ComponentModel.CancelEventArgs that contains event data.
The MaskedTextBox.OnValidating(System.ComponentModel.CancelEventArgs) method causes the input string to be validated against the MaskedTextBox.ValidatingType property, if a Type has been specified for this property. It will then also raise the MaskedTextBox.TypeValidationCompleted event.
To ensure consistency with text-based controls, validation will occur even if the System.Windows.Forms.MaskedTextBox is read-only (its MaskedTextBox.ReadOnly property is set to true).
Raising an event invokes the event handler through a delegate. For more information, see Raising an Event.
The MaskedTextBox.OnValidating(System.ComponentModel.CancelEventArgs) method also allows derived classes to handle the event without attaching a delegate. This is the preferred technique for handling the event in a derived class.