Private Sub Check1_Click(Index As Integer)
Check1(Index).Value = 0
Dim i As Integer
Dim p As Integer
For i = 0 To 2
If Check1(i).Value = 1 Then
p = i
Check1(p).Value = 0
End If
Next
Check1(Index).Value = 1
End Sub
我的目的是数组里面只能有一个checkbox被勾选,选中另一个的时候原先的勾就去掉,同时要保存下去掉的那个index。
Check1(Index).Value = 1这句话报错,说out of stack space
请问怎么办?或者达到我的目的还有什么其它方法么?
Check1(Index).Value = 0
Dim i As Integer
Dim p As Integer
For i = 0 To 2
If Check1(i).Value = 1 Then
p = i
Check1(p).Value = 0
End If
Next
Check1(Index).Value = 1
End Sub
我的目的是数组里面只能有一个checkbox被勾选,选中另一个的时候原先的勾就去掉,同时要保存下去掉的那个index。
Check1(Index).Value = 1这句话报错,说out of stack space
请问怎么办?或者达到我的目的还有什么其它方法么?
还是不太明白
你到底要实现单选还是多选?
单选直接用OPTION得了
If Check1(Index).Value = Checked Then
For i = 0 To Check1.Count - 1
If i <> Index Then Check1(i) = Unchecked
Next
End If