Form.ValidateChildren 方法
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
驗證表單中所有可選取的子控制項。
ValidateChildren() |
使得控制項內支援驗證的所有子控制項驗證其資料。 |
ValidateChildren(ValidationConstraints) |
使得控制項內支援驗證的所有子控制項驗證其資料。 |
- 來源:
- Form.cs
- 來源:
- Form.cs
- 來源:
- Form.cs
使得控制項內支援驗證的所有子控制項驗證其資料。
public:
override bool ValidateChildren();
C#
[System.ComponentModel.Browsable(true)]
public override bool ValidateChildren();
[<System.ComponentModel.Browsable(true)>]
override this.ValidateChildren : unit -> bool
Public Overrides Function ValidateChildren () As Boolean
傳回
如果所有子控制項都驗證成功,則為 true
;否則為 false
。 如果從 Validating 或 Validated 事件處理常式呼叫這個方法,則該方法一律會傳回 false
。
- 屬性
另請參閱
適用於
.NET Framework 4.8.1 和其他版本
產品 | 版本 |
---|---|
.NET Framework | 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
Windows Desktop | 3.0, 3.1, 5, 6, 7, 8, 9, 10 |
- 來源:
- Form.cs
- 來源:
- Form.cs
- 來源:
- Form.cs
使得控制項內支援驗證的所有子控制項驗證其資料。
public:
override bool ValidateChildren(System::Windows::Forms::ValidationConstraints validationConstraints);
C#
[System.ComponentModel.Browsable(true)]
public override bool ValidateChildren(System.Windows.Forms.ValidationConstraints validationConstraints);
[<System.ComponentModel.Browsable(true)>]
override this.ValidateChildren : System.Windows.Forms.ValidationConstraints -> bool
Public Overrides Function ValidateChildren (validationConstraints As ValidationConstraints) As Boolean
參數
- validationConstraints
- ValidationConstraints
將限制套用於已引發 Validating 事件的控制項。
傳回
如果所有子控制項都驗證成功,則為 true
;否則為 false
。 如果從 Validating 或 Validated 事件處理常式呼叫這個方法,則該方法一律會傳回 false
。
- 屬性
另請參閱
適用於
.NET Framework 4.8.1 和其他版本
產品 | 版本 |
---|---|
.NET Framework | 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
Windows Desktop | 3.0, 3.1, 5, 6, 7, 8, 9, 10 |