Hello
In the following code, when the Checkbox is checked, 10 pictureboxes are added to the form.
How do I do a Click event in these pictureboxes?Code:Private Sub CheckBox1_CheckedChanged(sender As Object, e As EventArgs) Handles CheckBox1.CheckedChanged Dim btnName As String 2: Dim x As Short = 0 3: 4: For i As Short = 1 To 10 5: btnName = "PictureBox" & CStr(i) 6: x += 20 7: Dim PictureBox As New PictureBox 8: 9: 10: PictureBox.Name = btnName 11: Me.Controls.Add(PictureBox) 12: PictureBox.Location = New Point(x, 10) 13: PictureBox.Text = "Hello" PictureBox.BorderStyle = BorderStyle.Fixed3D PictureBox.Height = 10 PictureBox.Width = 10 14: 15: 16: 17: Next End Sub


Reply With Quote
