Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

How do I extract the distinct values from a listview column

Posted on 2010-08-26
2
Medium Priority
?
471 Views
Last Modified: 2012-05-10
Hello,

I have a list view consisting of four columns. One of the these columns can contain duplicate values.  How can I extract the distinct values from that column.  I want to use those values to populate a combo box.  For example if the list view column has the following valued
1
1
2
2
2
3
3
I would want to extract 1, 2 ,3
0
Comment
Question by:chtullu135
2 Comments
 
LVL 17

Accepted Solution

by:
Zhaolai earned 2000 total points
ID: 33535888
Try this:

        For Each item As ListViewItem In ListView1.Items
            If ComboBox1.Items.Contains(item.SubItems(0).Text) = False Then
                ComboBox1.Items.Add(item.SubItems(0).Text)
            End If
        Next

Open in new window

0
 

Author Closing Comment

by:chtullu135
ID: 33541888
Thanks
0

Featured Post

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

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

This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …

916 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