Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Basic C# Application

Status
Not open for further replies.

millzy7

Programmer
Dec 9, 2003
96
US
Hi,

I have a timer control which writes to a file every 5 seconds but the application closes down before it gets to the second firing of the timer. How can i get the application to stay alive until the next timer interval comes around?

Thanks
 
Basic processing is to initialises the application, then wait for events. One of these will be your timer pop, others will be GUI interactions, some of which should cause the app to exit.

It sounds like you are exiting without waiting for an event that tells you to do so.

Perhaps you can post some code?
 
Thats sounds exactly like my problem. In my main method, i create an object that does all the work, as soon as that has completed, the main method completes and the application exits. I just want the application to sit around and wait for teh timer control to do stuff
 
If it's a Console application, just do a Console.ReadLine to wait for a keypress to terminate the app.

Chip H.


____________________________________________________________________
If you want to get the best response to a question, please read FAQ222-2244 first
 
Can you use System.Threading to pause processing before your app exits then call your timer after 5 seconds have elapsed?

"It's easier to ask forgiveness than it is to get permission." - Rear Admiral Dr. Grace Hopper
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top