AddHandler link an event with an event handler at run time.
Example:
1. Add event to an object
Public Class Form1
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.LoadDim Obj As New Class1
' Associate an event handler with an event
AddHandler Obj.myEvent, AddressOf EvHandler
Obj.Class1Event()
End Sub
Sub EvHandler()
' Handle the eventMsgBox("EvHandler")
End Sub
Public Class Class1
Public Event myEvent()
Public Sub Class1Event()
RaiseEvent myEvent()
End Sub
End Class
End Class
2. Handle events for dynamic runtime control