How to validate controls of the form before closing the form?
I have written handlers for Validating events of the controls of the form. 开发者_JS百科How can I trigger validation of the all elements on the form?
You can use the ValidateChildren() method.
I think you can achieve that by invoking ValidateChildren
on the form.
You should be able to handle the Closing event on the form and in there do a call to the Validate method. Based on the return value you would either let the form close or cancel the closing of the form.
精彩评论