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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Application not closing

Status
Not open for further replies.

SBM

Programmer
Nov 29, 2001
2
US
I am writing a desktop application in vb6, when I close the application it still show in the task manager
 
Is it a single form your app or it has other forms loaded. (not mdi children)?
How do you close it?

Provide first some info/
 
The application has an MDI form and all other forms are set to MDIChild = true

I close the MDI form with Unload ME
 
You may have classes/controls that do not unload properly and therefore keeping your form from being able to actually unload. In other words; you have a leak......

Greetings,
Rick
 
If possible, log the creation and destruction of forms/classes to a file. Once you think the program should be done check the log for forms or classes that are not being released.
 
END should never be used in a VB app. It is like getting out of a car while it is still moving. Sure, you'll stop, but whatever else that's moving will keep moving. Objects that have been created (particularly instances of OFFICE) will remain running until you kill them, or reboot.
This could use up all your memory and crash your system.

David
 
>As a last resort
Example: the program has to be finished now to be shown to the boss and the fact that the program is not closing is the one big obvious problem he/she should not see. 2 hours after the presentation, when the adrenaline is settling down, you look at the code, destroy all the objects and everyone lives happily ever after =>As a last resort.
-Max
 
be sure to close all objects declared on each forms of your project... eg. opened recordsets... because even if you've unloaded your form, some of the objects you've declared within it will still remain unreleased...

see example below...


dim mRS as new adodb.recordset
.
.
.
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
On Error Resume Next
mRS.close
Set mRS = Nothing
err.clear
End Sub



 
The two words that are never correct to use in the IT world: never and always.

QED by Max. :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top