Click to See Complete Forum and Search --> : Closing an Application


jplenhart
May 20th, 1999, 10:03 AM
I have an application that has one form you can call from the start up form (not sure if this is important but thought I would mention it) - It seems that when I close the application it is somehow still running when I view the processes in the Windows NT 4.0 Task Manager.

Is there anyway I can close an application completely????

Thank You

Gordito Supreme
May 22nd, 1999, 06:49 PM
So your project has 2 forms. What is going on is that when you terminate the application from your second form ... the startup form is still in memory. There are several ways to allievate this problem. If you don't need to go back to your startup form ever ... just unload it when you show the 2nd form (UnLoad frmStartup). If you are switching back from form to form, you need to unload the other form in each forms unload event. For example in the 2nd forms Unload Event you need to put the following line of code, Unload frmStartup, and in frmStartup's Unload event ... UnLoad frmMyOtherForm. Or, instead of putting this code in the Unload event, you can really be slick and put the following code in both of the forms QueryUnload event

Dim mess As Integer
If UnloadMode = 0 Then
mess = MsgBox("Do You Really Want to Quit?", vbQuestion + vbYesNo + vbDefaultButton2, Me.Caption)
If mess = vbNo Then
Cancel = True
Else
Unload frmWhatever ' the other form in the project
End If
End If

Gordito