Private WithEvents chk As CheckBox
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
chk = New CheckBox()
chk.Text = "hehe"
chk.Top = 0
chk.Left = 0
Me.Controls.Add(chk)
AddHandler chk.CheckStateChanged, AddressOf chk_CheckedChanged
End Sub
Private Sub chk_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox1.CheckedChanged
MsgBox("checkbox's state changed to " & sender.Checked)
End Sub