>>Public Class Main >> Inherits WindowsService >> >> Shared Sub Main(ByVal toArgs As String()) >> Startup(toArgs, New Main(), True) >> End Sub >>>>
>>Imports System.ServiceProcess >> >>Public Class WindowsService >> Inherits ServiceBase >> >> Public oTimer As New System.Timers.Timer(5000) >> >> Protected Shared Sub Startup(toArgs As String(), toWindowsService As WindowsService, tlInteractiveWait As Boolean) >> toWindowsService.OnStart(toArgs) >> End Sub >> >> Protected Overrides Sub OnStart(ByVal toArgs As String()) >> MyBase.OnStart(toArgs) >> >> ' Define the timer >> AddHandler oTimer.Elapsed, AddressOf ServiceTimer >> >> ' Start the timer >> oTimer.Enabled = True >> >> System.Windows.Forms.MessageBox.Show("End") >> End Sub >> >> Protected Overrides Sub OnStop() >> MyBase.OnStop() >> End Sub >> >> Private Sub ServiceTimer(ByVal sender As System.Object, ByVal e As System.Timers.ElapsedEventArgs) >> End Sub >>We also have our services set up that we can run them as console apps also if there is a problem to solve. Debugging is much easier that way as you have full debugging.