vb 复选框用Check1.Value = Checked的时候就自动运行了Check1_Click.怎么办?程序如图代码如下:Private Sub Check1_Click()If Check1.Value = 1 ThenFor i = 0 To 39Check2(i).Value = 1Next iElseIf Check1.Value = 0 ThenFor i = 0 To 39Che
来源:学生作业帮助网 编辑:六六作业网 时间:2024/11/25 07:11:06
vb 复选框用Check1.Value = Checked的时候就自动运行了Check1_Click.怎么办?程序如图代码如下:Private Sub Check1_Click()If Check1.Value = 1 ThenFor i = 0 To 39Check2(i).Value = 1Next iElseIf Check1.Value = 0 ThenFor i = 0 To 39Che
vb 复选框用Check1.Value = Checked的时候就自动运行了Check1_Click.怎么办?
程序如图
代码如下:
Private Sub Check1_Click()
If Check1.Value = 1 Then
For i = 0 To 39
Check2(i).Value = 1
Next i
ElseIf Check1.Value = 0 Then
For i = 0 To 39
Check2(i).Value = 0
Next i
End If
End Sub
Private Sub Check2_Click(Index As Integer)
Dim Check2ValueChecked,Check2ValueUnchecked As Boolean
Check2ValueChecked = False
Check2ValueUnchecked = False
For i = 0 To 39
If Check2(i).Value = 1 Then
Check2ValueChecked = True
Else
Check2ValueUnchecked = True
End If
Next i
If Check2ValueChecked = True And Check2ValueUnchecked = True Then
Check1.Value = 1
ElseIf Check2ValueChecked = True Or Check2ValueUnchecked = True Then
Check1.Value = 2
Else
Check1.Value = 0
End If
Check2ValueChecked = False
Check2ValueUnchecked = False
End Sub
帮我简化并解决一下吧,我希望check1与check2()共同被选或无选,或check2部分被选时check1.value=2
vb 复选框用Check1.Value = Checked的时候就自动运行了Check1_Click.怎么办?程序如图代码如下:Private Sub Check1_Click()If Check1.Value = 1 ThenFor i = 0 To 39Check2(i).Value = 1Next iElseIf Check1.Value = 0 ThenFor i = 0 To 39Che
先解决你的问题:
checkbox在设计时设置其value就不会引发click事件,但如果用代码的话就会引发click事件.
另外你的程序把简单的问题复杂化了,也许是我看得不仔细.