Multi-select list box

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Is there a way to change all items in a listbox to selected or de-selected
via code in one step? i.e. without looping through the ItemsSelected(I)
collection and changing each item to true or false?
 
Jim said:
Is there a way to change all items in a listbox to selected or
de-selected via code in one step? i.e. without looping through the
ItemsSelected(I) collection and changing each item to true or false?

Without looping? No way I know of. And you wouldn't loop through the
ItemsSelected collection anyway as that would provide no access to rows not
already selected. You would loop using the ListCount value to control the
number of loops and the row being accessed.
 
Deselecting all is easy: simply reset the RowSource or set the Listbox to
Null (the latter doesn't work for MultiSelect = Simple)

Selecting all can't be done without looping.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top