Results 1 to 17 of 17

Thread: [RESOLVED] Need to have the ability to copy/paste a file or folder back to my ListView

Threaded View

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Jan 2008
    Posts
    11,074

    Resolved [RESOLVED] Need to have the ability to copy/paste a file or folder back to my ListView

    I have an Explorer like application which displays folders and files the same as they are displayed in Explorer. If I select a file or a folder and then click on Copy menu option then click on Paste menu option I rename the file/folder to 'Copy of.....'. Now if I click on Paste again (with no other copy action) I rename that file/folder to Copy (2) of .....'. I can keep on doing this over and over each time renaming the file/folder to 'Copy (3) of .......', 'Copy (4) of......' etc, etc. Now if I select another file/folder and do a Copy/Paste I can rename that to 'Copy of....', Copy (2) of ......' etc, etc. Where my problem comes in is when I do a copy/past, let's say, on 'somefile.txt' I rename it to 'Copy of somefile.txt' and everything is OK, Now I do a copy/past on another file 'someotherfile.txt' and again I rename it to 'Copy of someotherfile.txt' and again everything is OK but if I go back to the first file, 'somefile.txt' and copy/paste it again my program isn't aware of the first time I did this so I wind up with another 'Copy of somefile.txt' so now I have two listings of the same name.

    My question is how would I go about avoiding this? I'm thinking about using a table of some sort or a Collection perhaps, but I don't have an idea how I would build this table/collection, access it to check if I have already made this copy/paste and keep track of the number of times the copy/paste occured so no matter when I do a copy/past of a previous file that has already been copied/pasted I always get the next sequence number for the Copy (nn) of.......'
    Last edited by jmsrickland; Feb 18th, 2016 at 09:02 PM.


    Anything I post is an example only and is not intended to be the only solution, the total solution nor the final solution to your request nor do I claim that it is. If you find it useful then it is entirely up to you to make whatever changes necessary you feel are adequate for your purposes.

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