[기타] [VB.NET] program that uses WithEvents, Handles

하나를하더라도최선을
2021-03-10 09:54
4,689
0
본문
Module Module1
' An instance of the Event class.
WithEvents EventClassInstance As New EventClass
Sub PrintTestMessage() Handles EventClassInstance.TestEvent
' This method handles the TestEvent.
Console.WriteLine("Test Message Being Printed...")
End Sub
Sub PrintTestMessage2() Handles EventClassInstance.TestEvent
' This method also handles the event.
Console.WriteLine("Test Message 2 Being Printed...")
End Sub
Sub Main()
' Call into the Event class and raise the test events.
EventClassInstance.RaiseEvents()
End Sub
Class EventClass
Public Event TestEvent()
Sub RaiseEvents()
' Raise the Test event.
' ... This needs to be part of the class with the Event.
RaiseEvent TestEvent()
End Sub
End Class
End Module
댓글목록0