Application.Exit() not exiting...

G

Guest

I am having a curious problem...

When 'Application.Exit()' command is executed in my program it does not end.
I set a breakpoint in the 'Dispose' methid that never gets called (yes, I am
in Debug mode) - what gives... this is certianly strange bahavior. The code
that I am running is below, I added Stop statements to alert me when the
applicaiton.exit() fails to quit the app...
Anyone have any ideas - I'm stuck!


Private Sub CheckForExistingLog(ByVal strLog As String)
If System.IO.File.Exists(strLog) Then
Debug.WriteLine(strLog & " was found")
If FileLen(strLog) > 0 Then
Debug.WriteLine("some previous actions failed...")
Me.SetAction("")
Me.SetLblTo("")
Me.SetSource("")
Me.SetTarget("")
Me.SetInfo("This patch has already been applied" & vbNewLine
& "Click Close to exit")
Me.pgTotal.Value = Me.pgTotal.Maximum
Application.Exit()
Stop
Else
Debug.WriteLine("all previous actions completed successfully")
Me.SetAction("")
Me.SetLblTo("")
Me.SetSource("")
Me.SetTarget("")
Me.SetInfo("This patch has already been applied" & vbNewLine
& "Click Close to exit")
Me.pgTotal.Value = Me.pgTotal.Maximum
Application.Exit()
Stop
End If
Else
Debug.WriteLine(strLog & " was NOT found")
Me.CreateOutputDataSet(strLog)
End If
End Sub
 
K

Ken Halter

I am having a curious problem...

When 'Application.Exit()' command is executed in my program it does not
end.
I set a breakpoint in the 'Dispose' methid that never gets called (yes, I
am
in Debug mode) - what gives... this is certianly strange bahavior. The
code
that I am running is below, I added Stop statements to alert me when the
applicaiton.exit() fails to quit the app...
Anyone have any ideas - I'm stuck!

I may be way off but... in VB6 (just poking around here), it doesn't matter
which command you use to end the app, the stack needs to "un-wind" itself.
That means all 'End Subs' need to run. If there's anything along the way
that would require a form to reload, VB6 will reload that form and the app
will never "die". IOW, that Stop you have should run every single time,
whether the Exit functionality works or not.... but, like I said, I may be
way off <g>
 
C

Cor Ligthert [MVP]

HZgt.

Sorry, I was thinking about another problem

AFAIK does the the application.exit as it is not in a "sub main". It does
nothing.

You can try "me.close" instead.

I hope this helps,

Cor
 
G

Guest

Ken,
Thanks for your thoughts... this seems to be moving in the right
direction... I see that all the code "downstream" of this sub runs regardless
of the app...exit()...

Looks like I'll have to use some if/then logic to detect if this sub
finished normally...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top