I have a Windows Service with a timer but the .Tick event is not being fired/called.
Don't know what code to include...I enabled and started the timer...I have the exact same code in a Windows form and it works fine, but in the service: nothing.
....
this.components = new System.ComponentModel.Container();
this.tmrTimer = new System.Windows.Forms.Timer(this.components);
//
// tmrTimer
//
this.tmrTimer.Interval = 6;
this.tmrTimer.Tick += new System.EventHandler(this.tmrTimer_Tick);
....
//In OnStart or Initialization -- tried both...
tmrTimer.Start();
tmrTimer.Enabled = true;
/*
also tried
tmrTimer.Enabled = true;
tmrTimer.Start();
*/
....
private void tmrTimer_Tick(object sender, System.EventArgs e) {
tCurrTime = DateTime.Now;
EventLog.WriteEntry("Timer Tick", "We have ticked...",
EventLogEntryType.Error);
if (tCurrTime.Hour == 0){
DoMidNightService();
}
Even a "did you check this" would be a great help.
Thanks,
J.