You have to create the timer in code;
Private mvTimer As New System.Timers.Timer(5000)
Protected Overrides Sub OnStart(ByVal args() As String)
AddHandler mvTimer.Elapsed, AddressOf mvTimer_Elapsed
mvTimer.Enabled = True
' or mvTimer.Start (not sure of the exact difference yet...)
End Sub
Private Sub mvTimer_Elapsed(ByVal pSender As Object, ByVal pArgs As
System.Timers.ElapsedEventArgs)
'this event had better fire!!
MessageBox.Show("I fired!!", "Yay!", MessageBoxButtons.OK,
MessageBoxIcon.Information)
End Sub
(add mvTimer.Enabled = False (or mvTimer.Stop) and RemoveHandler... to Sub
OnStop for completeness)
_____________________________
The Grim Reaper
"Scott H" <x@y.com> wrote in message
news:h9********************************@4ax.com...
I'm still stuck, someone must have written a windows Service in VB.NET
to get back to basics, I made this...
Protected Overrides Sub OnStart(ByVal args() As String)
Timer1.Enabled = True
End Sub
Private Sub Timer1_Tick(ByVal sender As Object, ByVal e As_
System.EventArgs) Handles Timer1.Tick
'this event is never fired
End Sub
(created as a window service)
It compiles, installs and I can start the service, but Timer1_tick is
never fired. I put the Timer1 onto the designer window rather than
create one in code.
Scott