Solved

Loop through selecteditem in listview with multiselect set to true

Posted on 2007-03-21
6
1,050 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 125 total points
ID: 18768869
probably not, sorry check here
http://www.visualbasic.happycodings.com/Forms/code60.html
same theory
0
Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

 
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

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

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

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
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…

717 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