1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

VB app failes to terminate under XP

Discussion in 'Software Development' started by aa6yq, Apr 5, 2004.

Thread Status:
Not open for further replies.
Advertisement
  1. aa6yq

    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
     
  2. coderitr

    coderitr

    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.)
     
  3. aa6yq

    aa6yq Thread Starter

    Joined:
    Apr 5, 2004
    Messages:
    2
    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
     
  4. DataBase

    DataBase

    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
     
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 733,556 other people just like you!

Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/217488

  1. 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.
    Dismiss Notice