Imports System.Timers Imports System.ServiceProcess Imports System Imports System.Diagnostics Public Class Main Inherits ServiceBase Shared Sub Main(ByVal toArgs As String()) Dim lcSource As String Dim lcLog As String Dim lcEvent As String 'Startup(toArgs, New Main()) Try Dim loMain As Main = New Main loMain.OnStart(toArgs) Catch loError As Exception lcSource = "My application" lcLog = "Application" lcEvent = loError.Message EventLog.WriteEntry(lcSource, lcEvent) End Try lcSource = "My application" lcLog = "Application" lcEvent = "This is just a log to see that we are at the end of Main" EventLog.WriteEntry(lcSource, lcEvent) End Sub Protected Overrides Sub OnStart(ByVal toArgs As String()) Dim lcSource As String Dim lcLog As String Dim lcEvent As String Try MyBase.OnStart(toArgs) ' Start the timer oTimer.Enabled = True Catch loError As Exception lcSource = "My application" lcLog = "Application" lcEvent = loError.Message EventLog.WriteEntry(lcSource, lcEvent) End Try End Sub Protected Overrides Sub OnStop() Dim lcSource As String Dim lcLog As String Dim lcEvent As String Try MyBase.OnStop() Catch loError As Exception lcSource = "My application" lcLog = "Application" lcEvent = loError.Message EventLog.WriteEntry(lcSource, lcEvent) End Try End Sub Private Sub ServiceTimer(ByVal sender As System.Object, ByVal e As System.Timers.ElapsedEventArgs) Dim lcSource As String Dim lcLog As String Dim lcEvent As String Try Catch loError As Exception lcSource = "My application" lcLog = "Application" lcEvent = loError.Message EventLog.WriteEntry(lcSource, lcEvent) End Try End SubThe only event added to the Event viewer is the one Main() as the OnStart() event does not fall into an error.