Hi,
What would be an easy way to select all and deselect all items in a ListView via a command button?
Thanks,
Dan
Printable View
Hi,
What would be an easy way to select all and deselect all items in a ListView via a command button?
Thanks,
Dan
will do the job (or was it Jop? ah forget it :))Code:Private Sub CmdSelectAll_Click()
'Call our cool function to select all
SelectAll
End sub
Private Sub CmdSelectNone_Click()
'Call our cool function to deselect all
SelectNone
End sub
Private Sub CmdInvert_Click()
'Call our cool function to invert the selection
InvertSel()
End sub
Private Function SelectAll()
For X = 1 To ListView1.ListItems.Count
ListView1.ListItems.Item(X).Selected = True
Next X
ListView1.SetFocus
End Function
Private Function SelectNone()
For X = 1 To ListView1.ListItems.Count
ListView1.ListItems.Item(X).Selected = False
Next X
ListView1.SetFocus
End Function
'Oh and if you need it, an Invert selection:
'All cool progs have an Invert selection mode :)
Private Function InvertSel()
For X = 1 To ListView1.ListItems.Count
ListView1.ListItems.Item(X).Selected = Not (ListView1.ListItems.Item(X).Selected)
Next X
ListView1.SetFocus
End Function
[Edited by Jop on 09-24-2000 at 12:30 PM]