I want my program to undertake a number of tasks prior to exiting. How do I ensure that if the user selects the Close icons at the top left and top right of the form that the program will perform these tasks?
there are 2 events in the form called "Terminate" and "Unload"<br>
they will do what you want <br>
double click on the form to bring up the code window then click in the upper right corner where is says "Load"<br>
scroll down to the bottom of the list to "Terminate" and "unload"<br>
<br>
example<br>
<br>
Private Sub Form_Unload(Cancel As Integer)<br>
' do everything here<br>
End<br>
'<br>
End Sub<br>
<br>
yOU CAN ALSO USE THE EVENT QUERY_UNLOAD OF THE FORM OBJECT TO ENSURE THE CHECKS GO WELL AND THEN HERE YOU CAN ALSO PREVENT THE FORM TO UNLOAD. USE THE CANCEL PARAMETRE THAT vb PASSES TO THIS EVENT.<br>
<p>Ravi Kochher<br><a href=mailto:rkochher@velos.ssind.com>rkochher@velos.ssind.com</a><br><a href= > </a><br>
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.