[求助]Check的选定状态为何出错
要求单击chkAllSelect(check控件)要求选中lstDispOrder(List控件)的所以项,如果当前的chkAllSelect是选定状态再单击此控件会取消lstDispOrder中的所有项.麻烦各位帮我看一下我的代码错在那里:
Private Sub chkAllSelect_Click()
Dim n As Integer
If chkAllSelect.Value = 0 Then
chkAllSelect.Value = 1
For n = 0 To Me.lstDispOrder.ListCount - 1
lstDispOrder.Selected(n) = True
Next n
Else
chkAllSelect.Value = 0
For n = 0 To Me.lstDispOrder.ListCount - 1
lstDispOrder.Selected(n) = False
Next n
End If
End Sub
Dim n As Integer
If chkAllSelect.Value = 0 Then
chkAllSelect.Value = 1
For n = 0 To Me.lstDispOrder.ListCount - 1
lstDispOrder.Selected(n) = True
Next n
Else
chkAllSelect.Value = 0
For n = 0 To Me.lstDispOrder.ListCount - 1
lstDispOrder.Selected(n) = False
Next n
End If
End Sub
红色字体处出现以下错误提示:
窗体控件图如下: