|
-
Jul 1st, 2002, 12:20 AM
#1
Thread Starter
Fanatic Member
Need Advice on Updating listview control
Ok, this is somewhat of a bug that I discovered in the first version of my program. I get information about MP3 files in a filelistbox and then add the info to different columns of a listview control. This is only done the first time the folder is selected, or if the user chooses to rebuild the library. After the listview is populated for the first time, a textfile (library) is created named after the foldername. Each time the folder is selected from then on (unless the user chooses to rebuild the library), the textfile is read and instantaneously populates the listview.
What the bug was?
In the first version of my program when the textfile populated the listview, I compared the file1.listcount to the listview1.listitems.count. If there were more or less files in the filelistbox then that meant the Listview needed to be updated because MP3s had been added or removed to/from that folder. Then I would completely rebuild the library (textfile). I want to improve this in my new version because there are two major problems with it:
1.) If there are Many files in the folder it is stupid to rebuild the library because it takes a long time, especially if you just added two files to the folder.
2.)What If I removed say "Green Day - JAR.mp3" and added "Good Charlotte - Festival Song.mp3" in the same folder? Obviously the listview needs to be updated, but it won't occur because of my comparison of the Listview count & filelistbox count.
So, I need advice on two things. Is there a way I could compare the filenames in the filelistbox to those in the listview listitems (since the Listitems in the main listview columns are the filenames). Then if the same filename is not found in both, get the info on it and append it to my textfile. Could I do this using by using the Sendmessage API for comparison? Any suggestions are appreciated. However, I prefer to use textfiles and avoid databases, as I've had no luck with them before.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|