Application needs to run every...

Hi, I need to develop an application that will start with the system, and every XX hours especified by the user, and at the time especified, this program has a routine that needs to be run.

How can I do this, with a "while" and keep checking,  with a timer and every second I verify....Or what is the best way


Answer this question

Application needs to run every...

  • Sachin Agarwal

     Rob Bazinet wrote:

    I have implemented a solution in this exact scenario.  After much careful testing I ended up using a Windows service and using System.Timers.Timer to have the server check every XX minutes.

    Our application was a job processor and reads from a database to get job configuration changes.  This could be done just as easily with an XML file and have the FileWatcher look for changes to the file and reload configuration at that point.

    It works very well and does not take much in the way of server resources.

    I hope this helps a bit.

    -Rob




    Can you give me a simple code, how FileWatcher works

    Thanks

  • Ebnez

    Sounds like you should create a Windows Service. When you are creating the project in visual studio, choose Windows Service from the templates list in the new project dialog box. Here's an MSDN link
    http://msdn.microsoft.com/library/default.asp url=/library/en-us/vbcon/html/vbconintroductiontontserviceapplications.asp

  • phoenixcu

    Hi
     the timer component is not gone, there are two timer components.
    For WinForms use the System.Windows.Forms.Timer class, you can drop this onto your Form from the toolbox.

    For the Windows service scenario, use the System.Timers.Timer class.

    http://msdn.microsoft.com/library/default.asp url=/library/en-us/vbcon/html/vbconserverbasedtimers.asp

    HTH

    .Hibri
    www.hibri.net

  • Jason10001

    I think that scheduler is not a good options, cause the server where it will be running is limited.... I need a routine to do it....

    That's dificult......

  • John Anderson

    Hi,

    I have exactly the same problem to solve for. Do you have your solution yet Can you share me some sample code if you have yours done.

    Thanks

  • Joshie76

    FileSystemWatcher is the exact name.  You can see a nice sample on Microsoft's web site - http://msdn.microsoft.com/library/default.asp url=/library/en-us/cpref/html/frlrfsystemiofilesystemwatcherclasstopic.asp

    Both VB.NET and C# examples.

    -Rob


  • RoelT

    Maybe I'm thinking too simple here, but wouldn't it be better to just throw it into the Windows Scheduler and have that deal with it

    You can make it run at boot and at specific intervals ont my W2k Pro at least, so it sounds like pretty much what you're looking for.

  • xChardx

    I have implemented a solution in this exact scenario.  After much careful testing I ended up using a Windows service and using System.Timers.Timer to have the server check every XX minutes.

    Our application was a job processor and reads from a database to get job configuration changes.  This could be done just as easily with an XML file and have the FileWatcher look for changes to the file and reload configuration at that point.

    It works very well and does not take much in the way of server resources.

    I hope this helps a bit.

    -Rob



  • dead man

    Sorry I am new to C# but is the timer component gone   If so can't you make a windows service as suggested above and write your own timer function

  • Application needs to run every...