How do I create an event handler for a programmatically created object in VB.NET?

You use AddHandler and AddressOf like this:

Dim MyButton as New Button()
MyButton.Name = "MyButton"
AddHandler MyButton.Click, AddressOf MyButton_Click

There is more info here in the MSDN documentation:

Leave a Comment