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
Solved

Loop through selecteditem in listview with multiselect set to true

Posted on 2007-03-21
6
1,035 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
  • 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 125 total points
ID: 18768869
probably not, sorry check here
http://www.visualbasic.happycodings.com/Forms/code60.html
same theory
0
Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

 
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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

839 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