• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 494
  • Last Modified:

How do I extract the distinct values from a listview column

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
chtullu135
Asked:
chtullu135
1 Solution
 
ZhaolaiCommented:
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
 
chtullu135Author Commented:
Thanks
0

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

Tackle projects and never again get stuck behind a technical roadblock.
Join Now