G
Guest
I am adding a seriese of controls to 'panel1' on 'form1' This works well but
I can't find a way to enable events. This example adds a 10 x 10 grid of
check boxes.
How can I create an event that will run if any of the check boxes are ticked.
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim x As Integer
Dim y As Integer
Dim pt As New System.Drawing.Point
Dim sz As New System.Drawing.Size
For x = 1 To 10
For y = 1 To 10
pt.X = x * 25 : pt.Y = y * 25
sz.Height = 17 : sz.Width = 17
myBox(x, y) = New CheckBox
If x = 1 And y = 1 Then myBox(1, 1) = cb
Panel1.Controls.Add(myBox(x, y))
With myBox(x, y)
.Text = ""
.Location = pt
.Size = sz
End With
Next y
Next x
Dim lbl As New LinkLabel
pt.X = 37 : pt.Y = 280
lbl.Text = "JF"
lbl.Location = pt
Panel1.Controls.Add(lbl)
End Sub
I can't find a way to enable events. This example adds a 10 x 10 grid of
check boxes.
How can I create an event that will run if any of the check boxes are ticked.
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim x As Integer
Dim y As Integer
Dim pt As New System.Drawing.Point
Dim sz As New System.Drawing.Size
For x = 1 To 10
For y = 1 To 10
pt.X = x * 25 : pt.Y = y * 25
sz.Height = 17 : sz.Width = 17
myBox(x, y) = New CheckBox
If x = 1 And y = 1 Then myBox(1, 1) = cb
Panel1.Controls.Add(myBox(x, y))
With myBox(x, y)
.Text = ""
.Location = pt
.Size = sz
End With
Next y
Next x
Dim lbl As New LinkLabel
pt.X = 37 : pt.Y = 280
lbl.Text = "JF"
lbl.Location = pt
Panel1.Controls.Add(lbl)
End Sub