Module Module1
Class MyEventArgs
Inherits System.EventArgs
Public Message As String
Public Time As DateTime
Public Sub New(ByVal S As String, ByVal DT As DateTime)
MyBase.New()
Message = S
Time = DT
End Sub
End Class
Class MyMonitor
Public Event EventStart(ByVal E As Object, ByVal Args As MyEventArgs)
Public Sub GenerateEvent()
Dim Args As New MyEventArgs("Hacker, Hacker", Now())
RaiseEvent EventStart(Me, Args)
End Sub
End Class
Dim WithEvents HackerAlarm As New MyMonitor()
Sub Attack(ByVal O As Object, ByVal Args As MyEventArgs) Handles HackerAlarm.EventStart
Console.WriteLine("Hack Attack in progress")
Console.WriteLine(Args.Message)
Console.WriteLine(Args.Time)
End Sub
Sub Main()
HackerAlarm.GenerateEvent()
End Sub
End Module
|