I have an USB controller, Xk-60 from P.I. Engineering, is configure and working properly. The following code read if a key is pressed on the controller and select a case based on the returned CID value. All good until here. Now a like to refer to several Checkbox dynamically also using the CID value. I don't seem to find the right way ...
This is not valid:
If e.PressState = True And **ctl.Checked** = False Then
Private Sub Xk60_80_1_ButtonChange(ByVal e As XK_60_80.XKeyEventArgs) Handles Xk60_80_1.ButtonChange
Select Case e.CID
Case 1001
Dim nbr As String = e.CID.ToString().Remove(0, 3)
Dim ctl() As Control = Me.Controls.Find("CheckBox" & nbr, True)
If e.PressState = True And ctl.Checked = False Then
CheckBox1.Checked = True
ElseIf e.PressState = True And CheckBox1.Checked = True Then
CheckBox1.Checked = False
End If
End Select
End Sub