![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | Windows service Timer elapsed event not firing Hi, I wrote a simple windows service program with a timer. The timer doesnt seem to be firing the elapsed event. Can someone tell why ? whats the problem with this code ? Thanks, Anand ----------------------- Imports System.IO Imports System.Timers Public Class goodmorningalarm Private WithEvents myTimer As New System.Timers.Timer(100) Protected Overrides Sub OnStart(ByVal args() As String) ' Add code here to start your service. This method should set things ' in motion so your service can do its work. AddHandler myTimer.Elapsed, AddressOf DoSomething myTimer.Start() myTimer.Enabled = True End Sub Protected Overrides Sub OnStop() ' Add code here to perform any tear-down necessary to stop your service. myTimer.Enabled = False End Sub Function DoSomething() As Integer MsgBox("test") 'Dim wr As New StreamWriter("c:\test.txt") 'wr.Write("Hello") Return 1 End Function End Class |
My System Specs![]() |
| | #2 (permalink) |
| | Re: Windows service Timer elapsed event not firing Sagar wrote: Quote: > Hi, > > I wrote a simple windows service program with a timer. The timer > doesnt seem to be firing the elapsed event. > > Can someone tell why ? whats the problem with this code ? > > Thanks, > Anand |
My System Specs![]() |
| | #3 (permalink) |
| | Re: Windows service Timer elapsed event not firing Doesnt help, I would've expected a precise reply. Anyways, Are you saying the code is correct and should work without issues ? I am doing this coding in vb.net 2008 Regards, Anand |
My System Specs![]() |
| | #4 (permalink) |
| | Re: Windows service Timer elapsed event not firing Sagar wrote: Quote: > Doesnt help, I would've expected a precise reply. > > Anyways, Are you saying the code is correct and should work without > issues ? code, and it may have blown up. Do you even know how to debug a Windows service by attaching a debugger to the Window service process? If things are not firing, it's because it never made it to do the firing is the most likely cause of the problem. |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| HELP need to solve this problem asap - Unable to start event viewer/event log service | Software | |||
| dynamic loaded ascx delegate event not firing in parent form | .NET General | |||
| Windows Event Log service will not start | Vista General | |||
| Timer event failing sporadically -- Office 2007 VBA | Vista General | |||
| Can't start Windows Event Log service | Vista General | |||