How select all records in a listbox

SteveL

Registered User.
Local time
Today, 10:54
Joined
Dec 3, 2004
Messages
60
I'd like to add a command button to my form which contains a listbox. When clicked I'd like all records to be selected. How can I do this?
 
First you have to have multi-select set to Simple or Extended (I like Extended).

Then you use code like this:

Code:
Dim intCount As Integer
        Do Until intCount = oList.ListCount
            oList.Selected(intCount) = True
            intCount = intCount + 1
        Loop
I've never been good at For Each Next but you could do the same thing with that as well.
 

Users who are viewing this thread

Back
Top Bottom