Click here to Skip to main content
15,886,799 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
I am creating a device application using dot net compact framework 2.0. there is a system.threading.timer in application which execute some code. its works fine. but my problem is when i am running the app by double clicking the exe, present in bin folder, the timer starts and execute all it works but it never stops. it runs in background even after closing the app by clicking X-button or from file menu close button. its working fine when i run the code in debug mode,timer stopped when i stop the program. but not working in exe. I don't understand how and where do i stop or dispose the timer so that it doesn't run after closing the app, may be something like form_closing event in window form application. I had searched a lot in google but don't get any proper answer.
Posted
Comments
Richard MacCutchan 21-Apr-15 5:37am    
How can the timer run when the app has stopped?
Geo Jackson 21-Apr-15 6:39am    
How are you saying that Timer running after app has been quit, may be you have misunderstood something.
Florian Braun 21-Apr-15 7:00am    
I don't know how you can say that timer is still running. But maybe it helps to set your timer=null as last line of your main?

1 solution

I cannot comprehensively solve your problem because I don't see your code, but maybe you can use some ideas:
First, look at the top answer to this question: http://stackoverflow.com/questions/12117906/detect-when-console-is-being-closed[^].

—SA
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900