Program won't end after form is closed

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • hd95
    New Member
    • Nov 2008
    • 24

    #1

    Program won't end after form is closed

    I have a VB6 program that will not stop running after I close out of the form manually. I have to go into task manager to shut it down.

    What am I doing wrong?
  • vb5prgrmr
    Recognized Expert Contributor
    • Oct 2009
    • 305

    #2
    If you have instantiated any objects you need to dispose of them. Like recordsets, controls, and so on. If after the form is unloaded, as if you are trying to save settings and you reference the form or its controls in any way, the form will be reloaded but not shown and thus your program will not end.



    Good Luck

    Comment

    • CyberSoftHari
      Recognized Expert Contributor
      • Sep 2007
      • 488

      #3
      use [code=vb]End [/code] in unload event.

      Comment

      • vb5prgrmr
        Recognized Expert Contributor
        • Oct 2009
        • 305

        #4
        CyberSoftHari,

        An expert advocating the use of End in a VB Program??? No expert, moderator, or Guru besides you has ever advocated the use of End in a VB program, in fact, everyone that I know of in the 16/17 sites that I'm a member of know that one should never use End in a vb program. It is bad programming practice to use end in a VB program because your program just stops. It has no opportunity to execute any code in the forms query unload, unload, and terminate subs if you have such code in those mentioned events. It can also lead to the runtimes and any other objects you have instantiated to be left in memory and not to mention the memory leaks it can cause by leaving threads and handles untaken care of....

        Just bad advice in my opinion! Don't you think finding out the cause of the problem would be better so that the OP can learn how to properly program in vb would be the better solution???

        Comment

        • CyberSoftHari
          Recognized Expert Contributor
          • Sep 2007
          • 488

          #5
          yes i agree in this case.

          Comment

          Working...