Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. No Duplicates in text file

No Duplicates in text file

Scheduled Pinned Locked Moved Visual Basic
algorithmshelp
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    johnjsm
    wrote on last edited by
    #1

    Hi, I am adding text to a text file but I don't want to have any duplicates. I am searching a system for files and if the file occurs twice I only want it added once to the text file. If any one can help it would be great. Thanks

    C D 2 Replies Last reply
    0
    • J johnjsm

      Hi, I am adding text to a text file but I don't want to have any duplicates. I am searching a system for files and if the file occurs twice I only want it added once to the text file. If any one can help it would be great. Thanks

      C Offline
      C Offline
      ChandraRam
      wrote on last edited by
      #2

      johnjsm wrote:

      Hi, I am adding text to a text file but I don't want to have any duplicates. I am searching a system for files and if the file occurs twice I only want it added once to the text file. If any one can help it would be great. Thanks

      There are many ways of implementing this... You could write it to a database table and check if it already exists (probably the easiest method) You could create a tree structure or some kind of sorted array in memory and search in it...

      1 Reply Last reply
      0
      • J johnjsm

        Hi, I am adding text to a text file but I don't want to have any duplicates. I am searching a system for files and if the file occurs twice I only want it added once to the text file. If any one can help it would be great. Thanks

        D Offline
        D Offline
        Dave Kreskowiak
        wrote on last edited by
        #3

        I agree with Chandra. The text file is just a place to store stuff when your app isn't running. So, do your work in memory, then write the end result to the file when your done. Don't try to work with it in the file itself.

        Dave Kreskowiak Microsoft MVP - Visual Basic

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups