Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Closing Program Using Close Icons at Top Left & Right of Form

Status
Not open for further replies.

Denk

Programmer
Jan 4, 2000
22
GB
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 &quot;Terminate&quot; and &quot;Unload&quot;<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 &quot;Load&quot;<br>
scroll down to the bottom of the list to &quot;Terminate&quot; and &quot;unload&quot;<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>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top