Solved

Loop through selecteditem in listview with multiselect set to true

Posted on 2007-03-21
6
1,027 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
Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

 
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
VBA: retain first and second level based on "." 6 69
Opening Remote & Local Data Connection 2 40
Validating VB6 Function 19 49
MsgBox 2 36
Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
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…
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…

708 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now