ContainerControl.Validate ContainerControl.Validate ContainerControl.Validate ContainerControl.Validate Method

定义

通过顺序引发 ValidatingValidated 事件验证失去焦点的控件的值。Verifies the value of the control losing focus by causing the Validating and Validated events to occur, in that order.

重载

Validate() Validate() Validate() Validate()

通过顺序引发 ValidatingValidated 事件验证失去焦点的控件的值。Verifies the value of the control losing focus by causing the Validating and Validated events to occur, in that order.

Validate(Boolean) Validate(Boolean) Validate(Boolean) Validate(Boolean)

验证失去焦点的控件的值;取决于是否打开了自动验证。Verifies the value of the control that is losing focus; conditionally dependent on whether automatic validation is turned on.

Validate() Validate() Validate() Validate()

通过顺序引发 ValidatingValidated 事件验证失去焦点的控件的值。Verifies the value of the control losing focus by causing the Validating and Validated events to occur, in that order.

public:
 bool Validate();
public bool Validate ();
member this.Validate : unit -> bool
Public Function Validate () As Boolean

返回

如果验证成功,则为 true;否则为 falsetrue if validation is successful; otherwise, false. 如果是从 ValidatingValidated 事件处理程序调用的,则该方法将始终返回 falseIf called from the Validating or Validated event handlers, this method will always return false.

注解

Validate方法验证未验证的最后一个子控件及其上级,但不包括当前容器控件。The Validate method validates the last child control that is not validated and its ancestors up through, but not including, the current container control. 此重载版本始终执行验证,而不考虑控件的父级AutoValidate的属性的值。This overloaded version always performs validation, regardless of the value of the AutoValidate property of the control's parent. 因此,使用它来无条件地强制进行验证。Therefore use it to unconditionally force validation.

另请参阅

Validate(Boolean) Validate(Boolean) Validate(Boolean) Validate(Boolean)

验证失去焦点的控件的值;取决于是否打开了自动验证。Verifies the value of the control that is losing focus; conditionally dependent on whether automatic validation is turned on.

public:
 bool Validate(bool checkAutoValidate);
public bool Validate (bool checkAutoValidate);
member this.Validate : bool -> bool
Public Function Validate (checkAutoValidate As Boolean) As Boolean

参数

checkAutoValidate
Boolean Boolean Boolean Boolean

如果为 true,则使用 AutoValidate 属性的值来确定是否应执行验证;如果为 false,则无条件地执行验证。If true, the value of the AutoValidate property is used to determine if validation should be performed; if false, validation is unconditionally performed.

返回

如果验证成功,则为 true;否则为 falsetrue if validation is successful; otherwise, false. 如果是从 ValidatingValidated 事件处理程序调用的,则该方法将始终返回 falseIf called from the Validating or Validated event handlers, this method will always return false.

注解

Validate方法验证未验证的最后一个子控件及其上级,但不包括当前容器控件。The Validate method validates the last child control that is not validated and its ancestors up through, but not including, the current container control. 此重载版本根据以下条件执行验证:This overloaded version performs validation based on the following conditions:

  • 如果参数为true,则始终对未验证的子控件进行验证。 checkAutoValidateIf the checkAutoValidate parameter is true, validation always occurs for child controls that are not validated.

  • 如果参数为false,则仅当启用控件的AutoValidate父项的属性时,才进行验证。 checkAutoValidateIf the checkAutoValidate parameter is false, validation occurs only if the AutoValidate property of the control's parent is enabled.

另请参阅

适用于