Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Listview control - multiple selections

Status
Not open for further replies.

peekay

Programmer
Oct 11, 1999
324
ZA
If one has chosen the multiple selection option on a listview control and one selects a few rows, how does one establish which rows(indexes) have been selected. Can anyone help. Thanks. Peekay
 
You need to use a for loop to go through the whole of the listview control from start to end.<br>
<br>
for i = 1 to listview.listitems.count<br>
if listview.listitems(i).selected = true then<br>
{your code}<br>
end if<br>
next i<br>
<br>
Its in the MultiSelect properties example on the MSDN CD that comes with Visual Studio 6.01<br>
<br>
James :)<br>

 
A little different way<br>
<br>
<br>
For a = 0 To List1.ListCount - 1<br>
If List1.Selected(a) = True Then<br>
Debug.Print &quot;Got it&quot;<br>
End If<br>
Next<br>
' this will let you know how many were selected<br>
Debug.Print List1.SelCount<br>

 
Thankyou both very much for the help
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top