blob: 3513fca136c2134ed1fc0ddcee145c5fc9e76dc5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
'To see if AddHandler supports non-AddressOf arguments
Imports System
Class C
Public Event E As EventHandler
Public Sub S()
RaiseEvent E(Me, EventArgs.Empty)
End Sub
End Class
Class C1
Dim x As C = New C
Sub setHandler()
AddHandler x.E, New EventHandler(AddressOf xh)
End Sub
Sub unsetHandler()
RemoveHandler x.E, New EventHandler(AddressOf xh)
End Sub
Sub call_S()
x.S()
End Sub
Sub xh(ByVal sender As Object, ByVal e As EventArgs)
Console.WriteLine("event called")
End Sub
End Class
Module M
Sub Main()
Dim y As New C1
y.setHandler()
y.call_S()
y.unsetHandler()
y.call_S()
End Sub
End Module
|