VB app failes to terminate under XP

Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

aa6yq

Thread Starter
Joined
Apr 5, 2004
Messages
2
Many users run this app on many versions of Windows without reporting problems. One user running XP reports that when he terminates the app, its windows dissappear, but the app is still show as running in the Task manager.

The last statement in the app's primary window's Form_Unload event handler is an END. Instrumentation shows that the statement before this END is being executed on every shutdown when tested by the user experiencing this problem.

Any ideas or pointers?

Dave
 
Joined
Oct 12, 2003
Messages
3,015
Welcome to TSG! :)

The instances in which I have seen a VB app fail to terminate have occured when there is an object loaded that does not get unloaded. I have seen this happen with Crystal Reports, database connections, and sub-forms. I have never, however, seen an application fail to terminate when the End statement is invoked. Are you sure that the Form_Unload event procedure is being executed? Does this happen on any operating system except XP? My advice is to pop up a message box just before the End statement in the Form_Unload event and if you see the message box, then obviously the program is reaching that part of the code. If not, then something is keeping the form from unloading (like a dependent object.)
 

aa6yq

Thread Starter
Joined
Apr 5, 2004
Messages
2
coderitr said:
Welcome to TSG! :)

The instances in which I have seen a VB app fail to terminate have occured when there is an object loaded that does not get unloaded. I have seen this happen with Crystal Reports, database connections, and sub-forms. I have never, however, seen an application fail to terminate when the End statement is invoked. Are you sure that the Form_Unload event procedure is being executed? Does this happen on any operating system except XP? My advice is to pop up a message box just before the End statement in the Form_Unload event and if you see the message box, then obviously the program is reaching that part of the code. If not, then something is keeping the form from unloading (like a dependent object.)
Thanks for the response. Yes, I am certain that the form_unload is being executed. The app includes a diagnostic logging facility that when enabled logs the termination process; the last such log entry is generated by the statement prior to the END -- and it always appears in the log generated by the user in question.

On another forum, it was suggested that terminating an application with END is a bad idea - better to loop on Forms.count, unloading every member of the Forms collection except the primary form, and then exit the Form_Unload handler. I'll be giving that a try.

Dave
 
Joined
Jan 15, 2004
Messages
770
Hello, i think the problem is the end statement, the end statement should only be used with uncompiled code and not within the exe. Im presuming you are refering to the exe format program which is not ending. im not sure why exactly but i have found this to occur sometimes aswell ONLY when im using the exe version of my program, but it works with the project.

So all you have to do is unload all the forms from the computers memory easy way to do so is

Dim FormCount As Integer

For FormCount = Forms.Count - 1 To 0 Step -1
Unload Forms(FormCount)
Next FormCount

try that see if it helps
 
Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 807,865 other people just like you!

Latest posts

Members online

Top