System.Windows.Forms.MaskedTextBox.ValidateText Method

Converts the user input string to an instance of the validating type.

Syntax

public object ValidateText ()

Returns

If successful, an object of the type specified by the MaskedTextBox.ValidatingType property; otherwise, null to indicate conversion failure.

Remarks

The MaskedTextBox.ValidateText method attempts to convert the formatted string contained in the MaskedTextBox.Text property to an instance of the type that is specified by the MaskedTextBox.ValidatingType property. Prompt characters are ignored in the formatted string, but literals are handled in accordance with the current value of the MaskedTextBox.TextMaskFormat property.

MaskedTextBox.ValidateText raises the MaskedTextBox.TypeValidationCompleted event after the conversion is attempted, regardless of its success.

Requirements

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