, :
Public Custom Event AddRemoveAttendees As EventHandler
AddHandler(ByVal value As EventHandler)
AddHandler _theButton.Click, value
End AddHandler
RemoveHandler(ByVal value As EventHandler)
RemoveHandler _theButton.Click, value
End RemoveHandler
RaiseEvent(ByVal sender As Object, ByVal e As System.EventArgs)
' no need to do anything in here since you will actually '
' not raise this event; it only acts as a "placeholder" for the '
' buttons click event '
End RaiseEvent
End Event
AddHandler RemoveHandler / Click.
, :
Dim _handlers As New List(Of EventHandler)
Public Custom Event AddRemoveAttendees As EventHandler
AddHandler(ByVal value As EventHandler)
_handlers.Add(value)
End AddHandler
RemoveHandler(ByVal value As EventHandler)
If _handlers.Contains(value) Then
_handlers.Remove(value)
End If
End RemoveHandler
RaiseEvent(ByVal sender As Object, ByVal e As System.EventArgs)
For Each handler As EventHandler In _handlers
Try
handler.Invoke(sender, e)
Catch ex As Exception
Debug.WriteLine("Exception while invoking event handler: " & ex.ToString())
End Try
Next
End RaiseEvent
End Event
, , , :
Public Event AddRemoveAttendees As EventHandler
, , . , ; , , , . , , . AddHandler :
AddHandler(ByVal value As EventHandler)
If _handlers.Count < 8 Then
_handlers.Add(value)
End If
End AddHandler
, .