?
Solved

Loop through selecteditem in listview with multiselect set to true

Posted on 2007-03-21
6
Medium Priority
?
1,061 Views
Last Modified: 2012-06-27
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
Comment
Question by:smcintire001
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 11

Expert Comment

by:andrewbleakley
ID: 18768079
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
 

Author Comment

by:smcintire001
ID: 18768826
That solution says its for a listbox.
Will it work for a listview as well?
0
 
LVL 11

Accepted Solution

by:
andrewbleakley earned 375 total points
ID: 18768869
probably not, sorry check here
http://www.visualbasic.happycodings.com/Forms/code60.html
same theory
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 13

Expert Comment

by:nike_golf
ID: 18770707
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
 

Author Comment

by:smcintire001
ID: 18772219
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
 
LVL 11

Expert Comment

by:andrewbleakley
ID: 18774030
0

Featured Post

Technology Partners: 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!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Suggested Courses

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question