Question Application Will Not Close

00shoe

Member
Joined
Oct 12, 2006
Messages
20
Programming Experience
3-5
Hi,

I search through this forum but I couldn't find a solution to this problem.

My problem is that Application.Exit doesn't work, and the program just continues along as normal.

The General Overview of My Code Follows:

VB.NET:
    Private Sub Run()

        'Some Code

        If problem found (i.e. incorrect data in file) Then

            SendEmail()

        End If

        'Mode Code...

    End Sub

    Private Sub SendEmail()

        'Send Email Code

        closeApplication()

    End Sub

    Private Sub closeApplication()

        'Close off other Objects...

        Application.Exit()

    End Sub

I have also tried Me.Close(), Application.ExitThread() and System.Threading.Thread.CurrentThread.Abort() but the some problem occurred.

Does anyone have any idea what I would be doing wrong?

Thanks!
 
Without more detail, I can't say for sure but it sounds like you still have some objects that are still running. If appropriate, try Marshall.ReleaseComObject().
 
Thanks for your help,

When I've try Debugging and what happen, is that it goes to Application.Exit() however it just keeps going like nothing happened.

I’ve try Marshall.ReleaseComObject() but it throws an error, is there a way to find what System.Runtime.InteropServices to close? What extra details would you need?

It appears that when I use Application.Exit or Me.Close() it will complete the procedure and because a Procedure is calling a Procedure that calling the close procedure it continues on and finish up each of those procedures.

Is there a way to stop the program as per that line (Me.Close())?


Many Thanks.
 
Last edited:
Back
Top