Checkbox event handler problem
Hello
I am trying to set up an event handler to detect clicks on checkboxes IN A PANEL.
The watch window shows two strange outputs:
1. Addhandler ... expression expected
2. CheckBoxx(intCounter).CheckedChanged ... 'CheckedChanged' is not a member of 'CheckBox'
Anyway, it isn't working. Any ideas?
Thank you.
Cut-down code:
Hello
I am trying to set up an event handler to detect clicks on checkboxes IN A PANEL.
The watch window shows two strange outputs:
1. Addhandler ... expression expected
2. CheckBoxx(intCounter).CheckedChanged ... 'CheckedChanged' is not a member of 'CheckBox'
Anyway, it isn't working. Any ideas?
Thank you.
Cut-down code:
Code:
Private Sub refreshprices_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Click
Dim numberofprices As Integer = (CurrentMarket.prices.Length)
Dim CheckBoxx(numberofprices) As CheckBox
Dim Panel1 As New Panel
Panel1.Location = New Point(10, 30)
Panel1.Size = New Size(400, 350)
Me.Controls.Add(Panel1)
For intCounter As Integer = 0 To CurrentMarket.prices.Length - 1
CheckBoxx(intCounter) = New CheckBox
CheckBoxx(intCounter).Size = New Size(15, 15)
CheckBoxx(intCounter).Location = New Point(20, spaceCounter)
Panel1.Controls.Add(CheckBoxx(intCounter))
AddHandler CheckBoxx(intCounter).CheckedChanged, AddressOf bxCheckedHandler
Next
End Sub
Private Sub bxCheckedHandler(ByVal Sender As Object, ByVal e As System.EventArgs)
MessageBox.Show(Sender.Text)
End Sub