There are many ways to approach this, but the simplest would be to add a verifyClosing
boolean field in your form class with an initial value of true
.
Whenever you want the form to close without confirmation then simply set verifyClosing = false
before calling the Close
method. Your closing event handler can check this value to decide what to do.