Public Class Foo
Public Event Click As EventHandler
Public Sub Fire()
RaiseEvent Click(Me, EventArgs.Empty)
End Sub
End Class
Public Class Bar
Private WithEvents foo1 As New Foo
Sub New()
foo1.Fire()
End Sub
Private Sub foo1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles foo1.Click
Console.WriteLine("Click")
End Sub
End Class
Module Program
Sub Main()
Dim bar1 As New Bar
End Sub
End Module
UHVibGljIENsYXNzIEZvbwogICAgUHVibGljIEV2ZW50IENsaWNrIEFzIEV2ZW50SGFuZGxlcgogICAgUHVibGljIFN1YiBGaXJlKCkKICAgICAgICBSYWlzZUV2ZW50IENsaWNrKE1lLCBFdmVudEFyZ3MuRW1wdHkpCiAgICBFbmQgU3ViCkVuZCBDbGFzcwoKUHVibGljIENsYXNzIEJhcgogICAgUHJpdmF0ZSBXaXRoRXZlbnRzIGZvbzEgQXMgTmV3IEZvbwogICAgU3ViIE5ldygpCiAgICAgICAgZm9vMS5GaXJlKCkKICAgIEVuZCBTdWIKICAgIFByaXZhdGUgU3ViIGZvbzFfQ2xpY2soQnlWYWwgc2VuZGVyIEFzIE9iamVjdCwgQnlWYWwgZSBBcyBFdmVudEFyZ3MpIEhhbmRsZXMgZm9vMS5DbGljawogICAgICAgIENvbnNvbGUuV3JpdGVMaW5lKCJDbGljayIpCiAgICBFbmQgU3ViCkVuZCBDbGFzcwoKTW9kdWxlIFByb2dyYW0KICAgIFN1YiBNYWluKCkKICAgICAgICBEaW0gYmFyMSBBcyBOZXcgQmFyIAogICAgRW5kIFN1YgpFbmQgTW9kdWxl