Module Module1
Class DailyJob
Public Event Coding(ByVal Item As String, ByVal StartTime As DateTime)
Public Event Testing(ByVal Item As String, ByVal StartTime As DateTime)
Public Event Meeting(ByVal Item As String, ByVal StartTime As DateTime)
Public Sub GenerateEvents()
RaiseEvent Coding("coding", Now())
RaiseEvent Testing("testing", Now().AddMinutes(5.0))
RaiseEvent Meeting("meeting", Now.AddMinutes(10.0))
End Sub
End Class
Dim WithEvents ThisDailyJob As New DailyJob()
Sub DoJob(ByVal Item As String, ByVal StartTime As DateTime)
Console.WriteLine("Starting " & Item & " at: " & StartTime)
End Sub
Sub Main()
AddHandler ThisDailyJob.Coding, AddressOf DoJob
AddHandler ThisDailyJob.Testing, AddressOf DoJob
AddHandler ThisDailyJob.Meeting, AddressOf DoJob
ThisDailyJob.GenerateEvents()
End Sub
End Module
|