VB中我需要限制复选框被选的个数
展开全部
你这样的做法最好是把所有的10个checkbox都做成一个控件数组
Private Sub Check1_Click(Index As Integer)
Dim i As Integer
Dim num As Integer
num = 0
For i = 0 To 9
If Check1(i).Value = 1 Then
num = num + 1
End If
Next
If num > 5 Then
MsgBox "您已选择了5个"
End If
End Sub
Private Sub Check1_Click(Index As Integer)
Dim i As Integer
Dim num As Integer
num = 0
For i = 0 To 9
If Check1(i).Value = 1 Then
num = num + 1
End If
Next
If num > 5 Then
MsgBox "您已选择了5个"
End If
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询