Results 1 to 2 of 2

Thread: Using listview.finditem to remove duplicate files....

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Apr 2001
    Posts
    25
    I was wondering how to use the listview.finditem before loading items into the list, then form an if statement on either not adding if it is allready there and adding if it isn't..... can anyone tell me how this is done? or if there is an easier way to prevent duplicate items plz let me know, thanks

  2. #2
    Addicted Member dmr's Avatar
    Join Date
    Jul 2000
    Location
    West-Germany :) Timezone: GMT +1 [DST] North.......: 52° 16’ 09” East...: 10° 31’ 16”
    Posts
    255

    Lightbulb

    You could use a key. When there's the same key twice an error occurs.

    Code:
       On Error Resume Next
       ListView1.ListItems.Add , Key, Text
    
       If Err.Number <> 0 Then    'The key exists twice
         'do some handling stuff...
    
       End If
    
       Err.Clear
    Hope this helps,
    Dennis.
    Code that I author is neither elegant nor efficient. It is, however, functional. Once I get something that works, I'm generally satisfied with myself - I mean, if it works, that's good enough, right?

    Originally posted by aknisely
    Sorry, but I feel uncomfortable on CC with clothes on
    __________________
    The truth ... is out there!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width