System.Windows.Forms.ContainerControl.ValidateChildren Method

Causes all of the child controls within a control that support validation to validate their data.

Syntax

[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
[System.ComponentModel.Browsable(false)]
public virtual bool ValidateChildren ()

Returns

true if all of the children validated successfully; otherwise, false. If called from the Control.Validating or Control.Validated event handlers, this method will always return false.

Remarks

ContainerControl.ValidateChildren will descend a control's hierarchy and examine each control to see if it supports validation. If the control can be selected by the user and its Control.CausesValidation property is true, ContainerControl.ValidateChildren will cause the Control.Validating event to occur. If any of the controls cancel the Control.Validating event, this method will return false; otherwise, it will return true.

If a control is bound to a data source, and the Control.Validating event occurs, it will cause the control to push its current data back to the data source.

Calling ContainerControl.ValidateChildren is equivalent to calling ContainerControl.ValidateChildren(ValidationConstraints) with a System.Windows.Forms.ValidationConstraints of ValidationConstraints.None.

Requirements

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