R
RD
Took a look at the sample code for timers, put it with simple mods in a new
VB.net project for a windows service.
Code I got is as follows:
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.
Dim aTimer As New System.Timers.Timer(10000)
AddHandler aTimer.Elapsed, AddressOf OnTimedEvent)
' Raise the event every time the timer elapses
aTimer.AutoReset = True
aTimer.Enabled = True
End Sub
' Specify what you want to happen when the event is raised.
Private Shared Sub OnTimedEvent(ByVal source As Object, ByVal e As
ElapsedEventArgs)
I will write my event handling code here
End Sub
In the IDE the word ElapsedEventArgs is underlined and I see that Type
ElapsedEventArgs is not defined. Can anyone tell me what's wrong with my
code. This is almost exactly a cut and paste from the MS examples. I<m
working with Framework 1.1 and VS.net 2033
Thanks for any help
Bob
VB.net project for a windows service.
Code I got is as follows:
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.
Dim aTimer As New System.Timers.Timer(10000)
AddHandler aTimer.Elapsed, AddressOf OnTimedEvent)
' Raise the event every time the timer elapses
aTimer.AutoReset = True
aTimer.Enabled = True
End Sub
' Specify what you want to happen when the event is raised.
Private Shared Sub OnTimedEvent(ByVal source As Object, ByVal e As
ElapsedEventArgs)
I will write my event handling code here
End Sub
In the IDE the word ElapsedEventArgs is underlined and I see that Type
ElapsedEventArgs is not defined. Can anyone tell me what's wrong with my
code. This is almost exactly a cut and paste from the MS examples. I<m
working with Framework 1.1 and VS.net 2033
Thanks for any help
Bob