Validation Before Closing Form

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,
reg:vb.net-pocket pc

I have set the maximize and minimize button of my form to false, so that
only the OK button is displayed. If the OK button is clicked, the form is
closed.

I have to perform a validation before closing the form. If it is true, the
form can be closed, otherwise a messagebox should be displayed and the form
should not be closed.

In which event of the form, I have to write the code? Only closing & closed
events are available. Both these events closes the form. I have used the
Exit Sub in these two events, but no use.

Regards,
Hari
 
In the Closing event change the e.Cancel to true or false based on your
needs.

Cheers
Daniel
 
Back
Top