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

  • Home
  • SEARCH
  • 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 1010575
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T09:06:17+00:00 2026-05-16T09:06:17+00:00

I have a variety of small C# winforms applications (though this should apply equally

  • 0

I have a variety of small C# winforms applications (though this should apply equally to any .NET app) which need to perform a few minor tasks when they are closed.

I have been making use of the .FormClosing event to do things like write the current settings file and wait for background threads to finish, etc.

Two questions came to mind about this as far as best practices go:

  • Do I need to stop timers (or similar tasks) when closing a form? Knowing that terminating the app should dispose of the timer, is it a good idea to issue a timer.Stop() in the closing of the form? Is it possible once having entered the .FormClosing method that the timer could trigger again?

  • Should last-minute tasks, such as writing a settings file, be in the .FormClosing or .FormClosed event (or elsewhere) and why?

Sorry for combining these questions but I felt they were related closely enough to warrant a single thread about properly closing a form-based app.

  • 1 1 Answer
  • 3 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-05-16T09:06:17+00:00Added an answer on May 16, 2026 at 9:06 am

    Should I stop a Timer?

    Not really but it won’t hurt either.

    Could a Timer trigger after FormClosing?

    Tricky. Not normally, but if some code in the Closing chain calls Application.DoEvents() I wouldn’t rule it out. Always a good idea to program your Timer-handler defensively.

    Should last-minute tasks be in .FormClosing or .FormClosed ?

    FormClosing is conditional, its main function is to show a “Save first?” box or similar. I would put everything in FormClosed unless it really needs to be earlier (ie it requires other components/controls to be alive and active).

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

Sidebar

Related Questions

I have an interface for a variety of classes, all of which should implement
I have a variety of strings which I need to work with, these contain
This is a Asp.net 3.5 Web Application I have a variety of data collections,
I have a VS2005 solution which contains a variety of projects (C++ DLLs, C++
I have this game with some variety of textures. Whenever I draw a texture
I have a scenario in which I think I need to lock a table
This is driving me crazy, and I have tried a variety of different things.
I have a variety of functions within my models which serve a different purpose.
I have a variety of anchor tags and input buttons that trigger a variety
I have tried a variety of different solutions found on stack and other places

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.