How do you end a visual basic program??? - basic.visual

This is a discussion on How do you end a visual basic program??? - basic.visual ; I'm having intermittent problems where I can't delete my VB6 executable. If I try to compile, VB6 says it can't overwrite the old executable file. XPSP2 can't delete the file, but I can copy another (completely different file renamed the ...

+ Reply to Thread
Results 1 to 2 of 2

How do you end a visual basic program???

  1. Default How do you end a visual basic program???

    I'm having intermittent problems where I can't delete my VB6
    executable. If I try to compile, VB6 says it can't overwrite
    the old executable file. XPSP2 can't delete the file, but I can copy
    another (completely different file renamed the same) file over
    it, but still can't delete the new file. Last time this happened,
    I saw two error messages
    from XP. 1) remove write protection and 2) somebody is using the
    program...or words to that effect. This time,
    I'm only getting the write protection message.
    If I reboot, the file is deletable.

    I'm perplexed. The program seems to work just fine.
    Don't have any program symptoms except the inability to delete.
    That sounds like it might cause major problems in the long run
    if something is left running.
    I can't find anything left running in process explorer.

    The program termination process seems a
    reasonable place to start.

    I have a stack of VB books taller than I am, but I can't find
    anything concrete on properly terminating a VB6 program.
    Googling wasn't much help either.
    I ended up with:

    Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
    Close All
    Unload mainform
    End Sub

    The exit button is:

    Private Sub Command2_Click()
    Close All
    Unload mainform
    'End
    End Sub


    I had an "end" in there but read that I shouldn't.

    There isn't anything in the form_unload procedure.
    The second Close all seems redundant, but shouldn't hurt???
    I don't understand why the Unload statement inside queryunload
    isn't an infinite loop. Actually, there's a lot I don't understand.
    I have no idea what I'm doing.

    And there's one more bizarre thing. This happened last week.
    I tried to isolate the problem by commenting out parts of my program
    until the symptom went away. Then I started putting them back.
    I got ALL the parts put back and the problem was still gone.
    Tweaked on the program for about a week before it came back.

    What's the proper way to terminate a VB6 program? I have to deal with
    my exit button, the "x" in the upper corner and system shutdown...yes???

    And any thoughts why the XP won't let me delete a program,
    but will let me overwrite it?

    Thanks, mike


    --
    Return address is VALID!

  2. Default Re: How do you end a visual basic program???

    mike <spamme9@gmail.com>'s wild thoughts were released on
    Thu, 31 Jan 2008 12:24:37 GMT bearing the following fruit:

    >I'm having intermittent problems where I can't delete my VB6
    >executable. If I try to compile, VB6 says it can't overwrite
    >the old executable file. XPSP2 can't delete the file, but I can copy
    >another (completely different file renamed the same) file over
    >it, but still can't delete the new file. Last time this happened,
    >I saw two error messages
    >from XP. 1) remove write protection and 2) somebody is using the
    >program...or words to that effect. This time,
    >I'm only getting the write protection message.
    >If I reboot, the file is deletable.
    >
    >I'm perplexed. The program seems to work just fine.
    >Don't have any program symptoms except the inability to delete.
    >That sounds like it might cause major problems in the long run
    >if something is left running.
    >I can't find anything left running in process explorer.
    >
    >The program termination process seems a
    >reasonable place to start.
    >
    >I have a stack of VB books taller than I am, but I can't find
    >anything concrete on properly terminating a VB6 program.
    >Googling wasn't much help either.
    >I ended up with:
    >
    >Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
    >Close All
    >Unload mainform
    >End Sub
    >
    >The exit button is:
    >
    >Private Sub Command2_Click()
    >Close All
    >Unload mainform
    >'End
    >End Sub
    >
    >
    >I had an "end" in there but read that I shouldn't.
    >
    >There isn't anything in the form_unload procedure.
    >The second Close all seems redundant, but shouldn't hurt???
    >I don't understand why the Unload statement inside queryunload
    >isn't an infinite loop. Actually, there's a lot I don't understand.
    >I have no idea what I'm doing.
    >
    >And there's one more bizarre thing. This happened last week.
    >I tried to isolate the problem by commenting out parts of my program
    >until the symptom went away. Then I started putting them back.
    >I got ALL the parts put back and the problem was still gone.
    >Tweaked on the program for about a week before it came back.
    >
    >What's the proper way to terminate a VB6 program? I have to deal with
    >my exit button, the "x" in the upper corner and system shutdown...yes???
    >
    >And any thoughts why the XP won't let me delete a program,
    >but will let me overwrite it?


    If you can't see your program in task manager, and you can
    overwrite the executable then I'd say this has nothing to do
    with your program not closing down properly.

    With that in mind, it might be worth asking in an XP group
    why you can't delete an executable.

    It's a long time ago but I seem to recall not being able to
    delete certain file types on XP (there was a fix to it
    though)


    --
    Jan Hyde

    https://mvp.support.microsoft.com/profile/Jan.Hyde

+ Reply to Thread