更新时间:2023-11-21 19:16:16
仅当接收焦点的控件的CausesValidation
属性设置为true时,才会引发Validating
事件.例如,如果您已在TextBox1的Validating事件中编写了代码,然后单击OK按钮(CausesValidation = true),则会引发Validating
事件,但是,如果您单击Cancel按钮(CausesValidation = false),则会出现不会引发Validating
事件.
TheValidating
event is raised only when the control that receives the focus has theCausesValidation
property set to true. For example, if you have written code in TextBox1''s Validating event, and you click the OK button (CausesValidation = true) then theValidating
event is raised, but if you click the Cancel button (CausesValidation = false) then theValidating
event is not raised.
您可以causesValidation
和validationgroup
属性.