'This is the class declaration
Public Class clsWork
Public ScriptName As String = ""
Public Frequency As Integer
Public xTimer As New System.Timers.Timer
Public Delegate Sub MyDelegate(ByVal strmessage As String)
Public m_Delegate As MyDelegate
Public Sub New()
AddHandler xTimer.Elapsed, AddressOf TimerFired
End Sub
Public Sub TimerFired(ByVal sender As Object, ByVal e As System.Timers.ElapsedEventArgs)
Call m_Delegate(ScriptName)
End Sub
'This part of the code is placed in the main program
'It is based on reading the ScriptName and Frequency from a file
Dim myWork As clsWork
myWork = New clsWork
With myWork
.ScriptName = MyDR.Item("ScriptName")
.Frequency = myDR.Item("Frequency")
.xTimer.Interval = .Frequency * 60 * 1000
.m_Delegate = AddressOf MainProcedure
.xTimer.Start()
End With
This was first published in January 2005