[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1101
  • Last Modified:

Loop through selecteditem in listview with multiselect set to true

Visual Basic 6
Listview w/ mutliselect

How can I loop through all selected items in a listview without looping through all items and checking to see if the item is checked?
0
smcintire001
Asked:
smcintire001
  • 3
  • 2
1 Solution
 
andrewbleakleyCommented:
http://www.developerfusion.co.uk/show/148/

Using this method will return only the selected items. It uses the Windows API to Send the Get Selected Items Message to the List.

Let me know if you need help implementing it
0
 
smcintire001Author Commented:
That solution says its for a listbox.
Will it work for a listview as well?
0
 
andrewbleakleyCommented:
probably not, sorry check here
http://www.visualbasic.happycodings.com/Forms/code60.html
same theory
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
nike_golfCommented:
I'm not sure that you can get through a list view and find only the select items... but this should work for you.


For x= 1 to ListView1.ListItems.Count
    If ListView1.ListItems(x).Selected Then
        'the rest of your code goes here
    End If
Next

NG,
0
 
smcintire001Author Commented:
Andrew:
Yes, I will need help implementing this.
Some of the constants aren't listed in the sample code (LV_ITEM, LVIF_TEXT, etc.).

0
 
andrewbleakleyCommented:
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now