Aart,
Rather then use a Console application, have you considered a Windows Service
application?
As a Windows Service are designed to run "forever", plus they can be started
when the machine starts, rather then require someone to log in.
If your app "needs" to be a Console application, as the others suggests, you
need to prevent your Main from exiting. I would probably use a Mutex,
AutoResetEvent, or ManualResetEvent (favoring the reset events over the
mutex) to keep it from exiting. This way the timer thread can have the main
thread exit if the timer thread decides its "done". By timer thread I mean
the thread where the System.Timers.Timer Elapsed event is raised...
Post if you want help with the reset events or the windows service.
--
Hope this helps
Jay [MVP - Outlook]
..NET Application Architect, Enthusiast, & Evangelist
T.S. Bradley -
http://www.tsbradley.net
"Aart Nicolai" <aa*********@gmail.com> wrote in message
news:11**********************@g43g2000cwa.googlegr oups.com...
| Hi all,
|
| I have developed a vb.net console application which will run some code
| every [x] seconds. To get this working I used a timer "System.Timers".
| When I start my console application it exits within a second. So I
| added the line: "Console.Read()". Everything seemes to run fine but
| after a few days the application stopped. Without an error.
| I think it has something to do with the lifetime of the
| "Console.Read()". Is this right?
|
| Is there another trick to solve this timer problem?
|
| Thanks,
|
| Aart
|