Which listview items are selected?

J

Julian Milano

I'm using the following code to act on only the selected items in a
listview. The items are selected via checkboxes:

Dim indexes As ListView.SelectedIndexCollection = .SelectedIndices
For Each i In indexes
ActiveXFileName = .Items(i).ToString
Call RegisterActiveXFile(ActiveXFileName)
Next
For some reason it does not work. Can someone explain why?
 
H

Herfried K. Wagner [MVP]

Julian Milano said:
I'm using the following code to act on only the selected items in a
listview. The items are selected via checkboxes:

Dim indexes As ListView.SelectedIndexCollection = .SelectedIndices
For Each i In indexes
ActiveXFileName = .Items(i).ToString
Call RegisterActiveXFile(ActiveXFileName)
Next
For some reason it does not work. Can someone explain why?

\\\
For Each Item As ListViewItem In Me.ListView1.CheckedItems
Call RegisterActiveXFile(Item.Text)
Next Item
///
 
G

Guest

i think it is ListView1.SelectedItems, here you have all the items that youve
selected.
 
H

Herfried K. Wagner [MVP]

Rothariger said:
i think it is ListView1.SelectedItems, here you have all the items that
youve
selected.

I was irritated by the "the items are selected via checkboxes" in the OP's
post.
 

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

Top