System.Windows.Forms.MaskedTextBox.OnValidating Method

Raises the Control.Validating event.

Syntax

[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Advanced)]
protected override void OnValidating (System.ComponentModel.CancelEventArgs e)

Parameters

e
A System.ComponentModel.CancelEventArgs that contains event data.

Remarks

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.

Note:

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.

Requirements

Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
Assembly Versions: 2.0.0.0