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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top