Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Window Services

Window Services

Scheduled Pinned Locked Moved Visual Basic
6 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    Navneet Hegde
    wrote on last edited by
    #1

    Hi All, I have build a window service with timer in it and i want to enter log after every 5 minutes,so I have written code in Timer_tick function , but It's not working ,Can I do that way , Or there is another way of doing it. Thanks & Wishes Navneet Hegde Nashik(City Of Pilgrimage)

    Develop2Program & Program2Develop

    S 1 Reply Last reply
    0
    • N Navneet Hegde

      Hi All, I have build a window service with timer in it and i want to enter log after every 5 minutes,so I have written code in Timer_tick function , but It's not working ,Can I do that way , Or there is another way of doing it. Thanks & Wishes Navneet Hegde Nashik(City Of Pilgrimage)

      Develop2Program & Program2Develop

      S Offline
      S Offline
      Sonia Gupta
      wrote on last edited by
      #2

      send me the code ....I will ty to rectify it.

      N 1 Reply Last reply
      0
      • S Sonia Gupta

        send me the code ....I will ty to rectify it.

        N Offline
        N Offline
        Navneet Hegde
        wrote on last edited by
        #3

        Hi Sonia, Namespace AlertService { public partial class AlertService : ServiceBase { public AlertService() { InitializeComponent(); } protected override void OnStart(string[] args) { // TODO: Add code here to start your service. timer1.Enabled = true; } protected override void OnStop() { // TODO: Add code here to perform any tear-down necessary to stop your service. timer1.Enabled = false ; } protected override void OnPause() { timer1.Enabled = false; //base.OnPause(); } protected override void OnContinue() { timer1.Enabled = true; //base.OnContinue(); } private void timer1_Tick(object sender, EventArgs e) { eventLog1.WriteEntry("Hai it's now " + DateTime.Now.ToString()); } } } This is what i have coded , Installation is working well with custom Event log , Start , Stop Pause , Continue is Logged but Only the Timer is not working Regards & Wishes Navneet Hegde Nashik(City Of Pilgrimage)

        Develop2Program & Program2Develop

        A D 2 Replies Last reply
        0
        • N Navneet Hegde

          Hi Sonia, Namespace AlertService { public partial class AlertService : ServiceBase { public AlertService() { InitializeComponent(); } protected override void OnStart(string[] args) { // TODO: Add code here to start your service. timer1.Enabled = true; } protected override void OnStop() { // TODO: Add code here to perform any tear-down necessary to stop your service. timer1.Enabled = false ; } protected override void OnPause() { timer1.Enabled = false; //base.OnPause(); } protected override void OnContinue() { timer1.Enabled = true; //base.OnContinue(); } private void timer1_Tick(object sender, EventArgs e) { eventLog1.WriteEntry("Hai it's now " + DateTime.Now.ToString()); } } } This is what i have coded , Installation is working well with custom Event log , Start , Stop Pause , Continue is Logged but Only the Timer is not working Regards & Wishes Navneet Hegde Nashik(City Of Pilgrimage)

          Develop2Program & Program2Develop

          A Offline
          A Offline
          aamironline
          wrote on last edited by
          #4

          You are using Window based Timer. User System.Threading.Timer instead...

          M Aamir Maniar aamirOnline.com

          N 1 Reply Last reply
          0
          • A aamironline

            You are using Window based Timer. User System.Threading.Timer instead...

            M Aamir Maniar aamirOnline.com

            N Offline
            N Offline
            Navneet Hegde
            wrote on last edited by
            #5

            Hi A I will try this and let you know Regards & Wishes Navneet Hegde Nashik(City Of Pilgrimage)

            Develop2Program & Program2Develop

            1 Reply Last reply
            0
            • N Navneet Hegde

              Hi Sonia, Namespace AlertService { public partial class AlertService : ServiceBase { public AlertService() { InitializeComponent(); } protected override void OnStart(string[] args) { // TODO: Add code here to start your service. timer1.Enabled = true; } protected override void OnStop() { // TODO: Add code here to perform any tear-down necessary to stop your service. timer1.Enabled = false ; } protected override void OnPause() { timer1.Enabled = false; //base.OnPause(); } protected override void OnContinue() { timer1.Enabled = true; //base.OnContinue(); } private void timer1_Tick(object sender, EventArgs e) { eventLog1.WriteEntry("Hai it's now " + DateTime.Now.ToString()); } } } This is what i have coded , Installation is working well with custom Event log , Start , Stop Pause , Continue is Logged but Only the Timer is not working Regards & Wishes Navneet Hegde Nashik(City Of Pilgrimage)

              Develop2Program & Program2Develop

              D Offline
              D Offline
              Dave Kreskowiak
              wrote on last edited by
              #6

              Next time, use the C# forum if you're working in C# code.

              A guide to posting questions on CodeProject[^]
              Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
                   2006, 2007

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups