I have defined the Validation(BeforeCloseEventArgs args) method and indicated its BeforeClose dialogue property.
Established the value of the Cancel property in both true and false.Put an interrupt in the debugger.The method is invoked when clicking buttons in the dialog, but the value of the Cancel property is not important.