windows service timer

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sarabonn
    New Member
    • Nov 2008
    • 69

    windows service timer

    Hallo Everyone,

    Iam using VB.NET with visual studio 2005. I have created a windows service which reads a .xml file and send a email. without any timer i installed the windows service it works fine but i added a timer and now not working. I want to check the time is for example 09:15 am and then send email everyday at that time .. my code in the Onstart is

    Protected Overrides Sub OnStart(ByVal args() As String)

    If (DateTime.Now.T oString("hh:mm tt") = "09:15 am") Then
    // i do the read xml and send mail operations here ..

    End If
    End sub

    so any idea ?.

    Dinesh.
  • sarabonn
    New Member
    • Nov 2008
    • 69

    #2
    Hallo everyone ,

    i have also tried using system.timers.t imer event handler and tried but nothing work out ..

    Protected Overrides Sub OnStart(ByVal args() As String)

    timer1 = New System.Timers.T imer(60000)
    AddHandler timer1.Elapsed, AddressOf OnTimedEvent

    End Sub

    Public Sub OnTimedEvent(By Val source As Object, ByVal e As Timers.ElapsedE ventArgs)

    // here i do the send email ..

    end sub

    Comment

    Working...