且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在单击按钮的窗体上运行所有验证事件

更新时间:2023-12-06 12:11:34

调用 ValidateChildren() 方法,使该表单的所有子控件验证其数据.

Calling ValidateChildren() method of the form, cause all of the child controls of the form to validate their data.

您还可以使用接受验证约束的方法的其他重载

You can also use the the other overload of the method which accepts a validation constraint, ValidateChildren(ValidationConstraints) to limit the validation to immediate child controls, enabled controls, tab stop controls, selectable controls, visible controls or all control.

要查看使用 Validating 事件和 Error 提供程序控件进行验证的示例,并显示错误摘要,并阅读有关Windows Forms中验证选项的更多信息,请查看以下内容帖子:

To see an example of validation using Validating event and Error provider control and showing error summary and also read more about validation options in Windows Forms, take a look at these posts: