我知道这个问题之前已经回答过,但我似乎无法得到一个可以满足我想要的答案,即能够检查我的动态创建的复选框是否已被选中,我需要能够检查每个复选框分别。
这是我创建复选框的代码
Private Sub CreateCheckbox(ByVal x As Integer, ByVal y As Integer, text As String, ByVal id As Integer)
Dim btnYes As System.Windows.Forms.CheckBox
btnYes = New System.Windows.Forms.CheckBox
btnYes.AutoSize = True
btnYes.TabStop = True
btnYes.Name = "CheckBox" + id
btnYes.TabIndex = id
btnYes.Parent = Panel1
btnYes.Size = New System.Drawing.Size(81, 17)
btnYes.Location = New System.Drawing.Point(x, y)
btnYes.TabIndex = 1
btnYes.Text = text
Button1.TabIndex = Button1.TabIndex + 1
Me.Panel1.Controls.Add(btnYes)
End Sub
我需要类似的东西
for i as integer = 0 to id step 1
if checkbox(i).checked = true then
'Do Something
end if
next