VS2005 MyApplication_Shutdown not getting fired.

We are developing windows application in VS2005 (VB.Net). I have placed resource clearing and audit entry in the "MyApplication_Shutdown" event. But this event is not getting fired when our application exits.

When I tired with the sample application, in our system it works fine. I don't know whether I have disabled any setting so that this event does get fired.

Note: I have checked application framework checkbox in application settings.






Answer this question

VS2005 MyApplication_Shutdown not getting fired.

  • Mahesh Gaware

    I followed the sample and had no problems hitting Shutdown.

    Is your event handler really in the partial MyApplication class of your vb project Does the function declaration end on Handler Me.Shutdown

    --
    SvenC


  • Walter30140

    Project + properties, Application tab, Shutdown mode = When last form closes. You can now close your login form without ending your app and the Shutdown event should fire when you close your main form.


  • Misiacik7

    Hi
    I could get the problem.

    We have a login screen as startup. If the login is valid we do the following
    frmLogin.hide()
    frmMain.show()

    Since we hide the screen, the shutdown event is not getting fired when we close the frmMain.

    Alternatively.
    frmLogin.close()
    frmMain.show()

    In this case the shutdown events gets fired, but my frmMain also getting closed. How to handle this.

    Nandagopal.




  • GreenStone90

    Its not working.

    Nandagopal


  • zenzai

    Hi,

    did you follow this sample: http://msdn2.microsoft.com/en-us/library/036kk0as(VS.80).aspx

    --
    SvenC


  • Samoyed

    Just combine the calls:

    frmLogin.Hide()
    frmMain.Show()
    frmLogin.Close()

    --
    SvenC


  • Shaurya

    Looking at the WindowsFormsApplicationBase class, the Shutdown event is fired right after Application.Run() exits. Not seeing this event means that Application.Run() doesn't exit normally. The only thing I can come up with: an unhandled exception. Do you trap the UnhandledException event

    Alternatives are to write an Application.ApplicationExit event or to not use not use the application framework and go back to plain-jane Main.


  • Anth0ny

    Hi Sven,

    I followed as given in the url sent by you.
    I even checked whether our application gets to abnormal exit.

    Nandagopal.P.K.S






  • VS2005 MyApplication_Shutdown not getting fired.