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

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 277
  • Last Modified:

adding item to list view exits sub if its a duplicate.

how can i add a item to a listview while having it exit sub if its a duplicate?
0
andyakira
Asked:
andyakira
1 Solution
 
Ryan ChongCommented:
Try use FindItem method, like:

...
Dim tmpItem As ListItem, i As Integer
    Set tmpItem = listview1.FindItem(mytext)
    If tmpItem Is Nothing Then
        i = listview1.ListItems.Count + 1
        'listview1.Sorted = False
        listview1.ListItems.Add i, , myext
        'listview1.Sorted = True
    End If
...

cheers
0
 
andyakiraAuthor Commented:
works great, ty
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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