I have two form classes inheriting from a common base. One of the forms is called modally and the other non-modally. Validatio开发者_运维知识库n is required on focus changes but not when the form is cancelled. When the Close Box is selected on the modal form it closes properly without any validation being triggered on it's controls. When the Close Box is selected on the non-modal form, validation events are triggered. A Cancel button with CausesValidation set false works fine in both cases.
I have tried setting CausesValidation on the non-modal form to false but the problem remains. I should mention that the forms are mdi children.
Any ideas?
Thx.
Set the "AutoValidate" property of the non-modal form to "Disable". This will prevent the Form from implicitly validating all child controls.
However, at a later time if you require to validate all child controls you can use Form.ValidateChildren() method. That will force validation for all contained child controls.
精彩评论