From: catharinus on 19 Feb 2010 16:42 Hello I am trying to quickly show the txt-files which are located in for example 320 subfolders of a folder and read the content of those files in a listview of a form. I can't find a QUICK way to do this. Should I use Sendmessage to do this? And if Yes ,how should I do this? Thanks Charles van der Werf
From: MikeD on 19 Feb 2010 17:45 "catharinus" <csvanderwerf(a)planet.nl> wrote in message news:5aa9d224-bae2-4bef-99ee-bc7761cc0d2f(a)g26g2000yqn.googlegroups.com... > Hello > > I am trying to quickly show the txt-files which are located in for > example 320 subfolders of a folder and read the content of those files > in a listview of a form. I can't find a QUICK way to do this. Should I > use Sendmessage to do this? And if Yes ,how should I do this? So you're searching for txt files in 320 folders? And then reading those files and loading their contents into a listview? And what would your idea be (time-wise) of doing this quickly? There are many factors involved. Do any of those 320 subfolders have their own subfolders that you're also searching? Approximately how many txt files? Are you loading the entire contents of ALL txt files into the ListView (and why a ListView)? That could take anywhere from a couple of minutes to perhaps several hours. It all depends, not only on just the couple things I mentioned but also the computer and its hardware. Probably your best option to find the files is to use the FindFirstFile, FindNextFile, and FindClose API functions. Search the newsgroup for FindFirstFile and you'll find plenty of example code to use these functions in a recursive procedure (recursion is what makes it possible to specify one folder and search all its subfolders). For reading each file's contents, I'd think VB's own file I/O should be fine. You're also probably going to find that this will slow down exponentially as you add more and more ListItems into the ListView. Which is why I question using a ListView for this. -- Mike
From: catharinus on 19 Feb 2010 17:59 On 19 feb, 23:45, "MikeD" <nob...(a)nowhere.edu> wrote: > "catharinus" <csvanderw...(a)planet.nl> wrote in message > > news:5aa9d224-bae2-4bef-99ee-bc7761cc0d2f(a)g26g2000yqn.googlegroups.com... > > > Hello > > > I am trying to quickly show the txt-files which are located in for > > example 320 subfolders of a folder and read the content of those files > > in a listview of a form. I can't find a QUICK way to do this. Should I > > use Sendmessage to do this? And if Yes ,how should I do this? > > So you're searching for txt files in 320 folders? And then reading those > files and loading their contents into a listview? And what would your idea > be (time-wise) of doing this quickly? There are many factors involved. Do > any of those 320 subfolders have their own subfolders that you're also > searching? Approximately how many txt files? Are you loading the entire > contents of ALL txt files into the ListView (and why a ListView)? That could > take anywhere from a couple of minutes to perhaps several hours. It all > depends, not only on just the couple things I mentioned but also the > computer and its hardware. > > Probably your best option to find the files is to use the FindFirstFile, > FindNextFile, and FindClose API functions. Search the newsgroup for > FindFirstFile and you'll find plenty of example code to use these functions > in a recursive procedure (recursion is what makes it possible to specify one > folder and search all its subfolders). > > For reading each file's contents, I'd think VB's own file I/O should be > fine. > > You're also probably going to find that this will slow down exponentially as > you add more and more ListItems into the ListView. Which is why I question > using a ListView for this. > > -- > Mike At this moment, it takes appr, 7 seconds, but is should be 1 second. Every subfolder contrains one textfile and the information of that textfile is put on a listview. Should I use a MSFlexgrid, is that quicker? The reading is done about a hunderd times by bookkeepers, thats why it should be quick.> Thanks Catharainus
From: Karl E. Peterson on 19 Feb 2010 18:20 catharinus wrote: > At this moment, it takes appr, 7 seconds, but is should be 1 second. > Every subfolder contrains one textfile and the information of that > textfile is put on a listview. Should I use a MSFlexgrid, is that > quicker? The reading is done about a hunderd times by bookkeepers, > thats why it should be quick.> Break the problem down, to find the bottleneck. For example, if you comment out the part that adds the text to the listview, is it fast enough? (Betting yes, common controls tend to be slugs!) -- ..NET: It's About Trust! http://vfred.mvps.org
From: MikeD on 19 Feb 2010 18:24 "catharinus" <csvanderwerf(a)planet.nl> wrote in message news:ab3f1894-c01f-4019-b15c-9c25a8906291(a)d2g2000yqa.googlegroups.com... > > At this moment, it takes appr, 7 seconds, but is should be 1 second. > Every subfolder contrains one textfile and the information of that > textfile is put on a listview. Should I use a MSFlexgrid, is that > quicker? The reading is done about a hunderd times by bookkeepers, > thats why it should be quick.> So your complaint is that it takes 7 seconds to search 320 subfolders for ..txt files and display the contents of those files in a ListView? What make you think it should only take 1 second? IMO, 7 seconds is not that bad. As I said, I could see it taking minutes to hours, depending on number of files, size of those files, etc., etc. Maybe these bookkeepers just need faster computers, or faster hard drives, or maybe they just need to defrag their hard drives. If you're not using FindFirstFile and FindNextFile, you might try them. They might make things a little faster (just kind of making an assumption since you didn't state HOW you're currently searching these 320 folders for these .txt files). I can't tell you whether it'd actually be worth the time and effort. The only way to know is to try and see if the results are better. -- Mike
|
Next
|
Last
Pages: 1 2 3 Prev: use sendmessage to find folders and files in the folders in vb6 Next: VB6 on Windows 7 64-Bit |