Hello my friends... I got one issue with my Form's CheckBox and ListBox.
When I click on the CheckBox, it unmarks/marks every item in ListBox...
Works fine:
When I click on ListBox itens, if my click marks ALL itens, it marks the CheckBox![]()
Private Sub chb_MarkAll_Click() Dim iLoop As Integer With frm_Files For iLoop = 0 To .lst_Files.ListCount - 1 .lst_Files.Selected(iLoop) = .chb_MarkAll Next iLoop End With End Sub
The problem is: When I try to put both codes together, they conflict![]()
Private Sub lst_Files_Change() Dim iLoop As Integer Dim booMark As Boolean booMark = True With frm_Files.lst_Files For iLoop = 0 To .ListCount - 1 If Not .Selected(iLoop) Then booMark = False Exit For End If Next iLoop End With If booMark Then frm_Files.chb_MarkAll = True Else frm_Files.chb_MarkAll = False End If End Sub
What happens:
* Cannot mark the Checkbox by clicking, because it activates the listbox event, and unmark the checkbox, because it runs the loop
* When I mark by clicking all itens in listbox, checkbox gets marked, but when, after, I unmark one item, the checkbox gets unmarked, making the code of checkbox unmark ALL listbox itens
![]()











LinkBack URL
About LinkBacks

Register To Reply
Bookmarks