AutoValidate Enumeration

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Determines how a control validates its data when it loses user input focus.

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

type AutoValidate

Member nameDescription
Disable

Implicit validation will not occur. Setting this value will not interfere with explicit calls to Validate or ValidateChildren.

EnableAllowFocusChange

Implicit validation occurs, but if validation fails, focus will still change to the new control. If validation fails, the Validated event will not fire.

EnablePreventFocusChange

Implicit validation occurs when the control loses focus.

Inherit

The control inherits its AutoValidate behavior from its container (such as a form or another control). If there is no container control, it defaults to EnablePreventFocusChange.

If a user switches focus off of a Windows Forms control, the control will use AutoValidate to determine how to validate its data. This type of validation is called implicit validation, because it occurs without the application developer having to make an explicit call to Validate or ValidateChildren.

The property corresponding to this value will have different defaults based on the type of control. For more information, see User Input Validation in Windows Forms.

The following code example turns off implicit validation for a form and all of its contained controls, and instead manually performs validation of all of the form's children when a mouse button is clicked.

No code example is currently available or this language may not be supported.

.NET Framework
Available since 2.0
Return to top
Show: