Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8895109
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T23:41:12+00:00 2026-06-14T23:41:12+00:00

I need to close my application in the same way, whether it is closed

  • 0

I need to close my application in the same way, whether it is closed directly or closed from task bar or task manager. I need to do some pre-settings and automatically generate log files each time before the application is closed…

For example I give following effect to my application form each time it exits, but this effect is not shown when I close my application from task bar or task manager…

    System.Windows.Forms.Timer closeTimer = new System.Windows.Forms.Timer();

    void lblClose_Click(object sender, System.EventArgs e)
    {
        closeTimer.Tick += new EventHandler(closeTimer_Tick);
        closeTimer.Interval = 10;
        closeTimer.Start();            
    }

    void closeTimer_Tick(object sender, EventArgs e)
    {
        int a = (int)(this.Opacity * 100);
        a--;
        this.Opacity = ((double)a / 100);
        if ((this.Opacity*100) == 0)
            this.Close();
    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T23:41:13+00:00Added an answer on June 14, 2026 at 11:41 pm

    I’m assuming your app is a System.Windows.Forms.Application. If so you can listen to ApplicationExit event.

    So in Main, do something like:

    Application.ApplicationExit += (s,e) =>
    {
       // Your exit code.
    };
    

    See http://msdn.microsoft.com/en-us/library/system.windows.forms.application.applicationexit.aspx

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

For my web application I need to close the child window whenever the parent
Developing a C# .NET 2.0 WinForm Application. Need the application to close and restart
I am developing a SilverLight application wherein on browser close event, i need to
I need to do a quick and dirty way of upgrading my application. Currently
I need to close the colorbox iframe that overlays the website with an onclick
Does it need manually close InputStream (bean.getContentAsStream()) in java after pass to Spring JDBC
I have gtk.Window and I need to catch closure. I need to close the
I have my code as a jsFiddle . i need to close the previous
How to make activities that register BroadCastReceiver? Because I need to close all the
I need to sort close to a 1,00,000 floating point entries in Delphi. I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.