Selecting all records in a list box

  • Thread starter Thread starter JKlein
  • Start date Start date
For i = 1 To Me.lstBookings.ListCount - 1
Me.lstBookings.Selected(i) = True
Next i

note that the selected array is zero based, hence we go less one.

Also, if you have the "show headings" for the list box turned on, then the
first row (0) needs to be ignored.

So, the above code looks a bit strange, since we skip the first row (0), and
we are using a zero based list reference....

If you listbox does not have the headings turned on..then start the above
loop from 0....
 

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