Module Module1
Class Job
Public Event Meeting()
Public Event Testing(ByVal Temp As Integer)
Public Event Coding(ByVal Room As String, ByVal Duration As Integer)
Public Sub GenerateEvents()
RaiseEvent Meeting()
RaiseEvent Testing(212)
RaiseEvent Coding("VB.net", 25)
End Sub
End Class
Dim WithEvents Alarms As New Job()
Sub MyMeeting() Handles Alarms.Meeting
Console.WriteLine("MyMeeting alarm occurred")
End Sub
Sub MyTesting(ByVal Temp As Integer) Handles Alarms.Testing
Console.WriteLine("MyTesting alarm occurred: Temp: " & Temp)
End Sub
Sub MyCoding(ByVal Room As String, ByVal Duration As Integer) Handles Alarms.Coding
Console.WriteLine("MyCoding alarm occurred: " & Room & " " & Duration)
End Sub
Sub Main()
Alarms.GenerateEvents()
End Sub
End Module
|