I'm implementing a folder browser style control in a tree view.
Windows Explorer, when it comes up with a tree view, almost immediately,
knows if folders contain other folders or not (unless it's a networked
drive).
How does it accomplish this? Obviously doing Directory.GetDi rectories() for
each subdirectory is not going to give me that sort of immediate response.
Pete 4 2602
Really, have you tried it? Is it noticeably slow?
Yes, beyodn trying, I've actually got it written and I'm dissatisified with
the performance, which is why I'm now asking here. It's particularly
affected by the number of subdirectories. So if I do a
Directory.GetDi rectories() on a folder that has say, 1000 sub directories,
it's going to be far slower, which makes sense.
Pete
"Alexander Kolliopoulos" <ak******@gmail .com> wrote in message
news:11******** **************@ o13g2000cwo.goo glegroups.com.. . Really, have you tried it? Is it noticeably slow?
Make sure that GetDirectories( ) is the culprit. Try calling it on a large
folder without displaying anything and time it.
My first bet would be the treeview.
Try suspending layout when adding items:
treeView1.Suspe ndLayout();
.... add stuff
treeView1.Resum eLayout();
Also try adding the items to the tree using AddRange().
Oh, and obviously don't forget to NOT populate the whole tree at once
recursively.
--
Robert Jeppesen
Durius http://www.durius.com/
"Pete Davis" <pdavis68@[nospam]hotmail.com> wrote in message
news:4I******** ************@gi ganews.com... Yes, beyodn trying, I've actually got it written and I'm dissatisified with the performance, which is why I'm now asking here. It's particularly affected by the number of subdirectories. So if I do a Directory.GetDi rectories() on a folder that has say, 1000 sub directories, it's going to be far slower, which makes sense.
Pete
"Alexander Kolliopoulos" <ak******@gmail .com> wrote in message news:11******** **************@ o13g2000cwo.goo glegroups.com.. . Really, have you tried it? Is it noticeably slow?
Ah, SuspendLayout did make a big difference. For very large directories,
there's a bit of a period where it blanks out, but it's still far faster
than before. Definitely acceptable.
And yes, I'm not populating the entire tree at once. Just a level at a time
as branches are expanded.
Thanks.
Pete
"Robert Jeppesen durius (dot) com>" <robert<at> wrote in message
news:ey******** ********@TK2MSF TNGP09.phx.gbl. .. Make sure that GetDirectories( ) is the culprit. Try calling it on a large folder without displaying anything and time it.
My first bet would be the treeview. Try suspending layout when adding items: treeView1.Suspe ndLayout(); ... add stuff treeView1.Resum eLayout();
Also try adding the items to the tree using AddRange().
Oh, and obviously don't forget to NOT populate the whole tree at once recursively.
-- Robert Jeppesen Durius http://www.durius.com/
"Pete Davis" <pdavis68@[nospam]hotmail.com> wrote in message news:4I******** ************@gi ganews.com... Yes, beyodn trying, I've actually got it written and I'm dissatisified with the performance, which is why I'm now asking here. It's particularly affected by the number of subdirectories. So if I do a Directory.GetDi rectories() on a folder that has say, 1000 sub directories, it's going to be far slower, which makes sense.
Pete
"Alexander Kolliopoulos" <ak******@gmail .com> wrote in message news:11******** **************@ o13g2000cwo.goo glegroups.com.. . Really, have you tried it? Is it noticeably slow?
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Gema Gema |
last post by:
I have a large collection of directories full of various files and am
looking to create custom text files for the contents of each
directory. Here is the situation:
The directories are named with a name and number, i.e. Smith1234567.
I am looking to create a text file named with the number portion of
the directory name (1234567.txt). The contents of the text file would
look similar to the following, where the "TIF" files at the end of...
|
by: Dfenestr8 |
last post by:
os.listdir("path") returns the names of all the items in a directory ok,
but I need to know whether the item is a file or a directory.
Can anybody tell me how this could be done?
|
by: Dave |
last post by:
I am getting te following error in a ASP.Net app that is running on Win XP
Pro (SP2):
Server cannot access application directory 'C:\Documents and
Settings\dave\My Documents\My Visual Studio ASP.NET\MyWebSite\'. The
directory does not exist or is not accessible because of security settings.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information...
|
by: bloggs |
last post by:
I am writting an application that runs on an FTP server. The purpose of the app is to uncompress gzip files that are sent to the server and then move the file to another folder according to it's contents. The challenge I am having is preventing the application from uncompressing a file before the file has landed on the server in its entirety. Currently, I am using the following statement to check for incoming files
For Each sFile In...
|
by: Phil Galey |
last post by:
Using the following, you can determine the size of a file:
Dim fi As New IO.FileInfo(<Path to file>)
MsgBox(fi.Length)
.... but what about the size of a directory? The IO.DirectoryInfo object
doesn't have a Length property.
In is there a way in VB.NET to determine the size of a directory without
having to resort to importing the Scripting DLL and using the
FileSystemObject? Thanks.
| |
by: Rob_S |
last post by:
I have a program which saves time stamped files into time stamped
directories.
When I want to read these files, I get the current date and check for the
existence of the directory using....
while (!(_chdir(dirname)) == 0)
{reduce the directory name (time) and check again}
This method quickly finds the last directory but I don't know anything about
|
by: petermichaux |
last post by:
Hi,
I'm hoping for a reason I'm wrong or an alternate solution...
I'd like to be able to dynamically include some javascript files. This
is like scriptaculous.js library but their solution is broken in
Firefox 1.5.0.1 on OS X. What happens with the Scriptaculous library is
this
In the html document the author only has to include one line
|
by: tubby |
last post by:
Silly question, but here goes... what's a good way to determine when a
file is an Open Office document? I could look at the file extension, but
it seems there would be a better way. VI shows this info in the files:
mimetypeapplication/vnd.oasis.opendocument.textPK
mimetypeapplication/vnd.oasis.opendocument.presentationPK
etc.
Not really a Python specific question but, how do you guys do this sort
of thing? I've figured out how to...
|
by: techusky |
last post by:
I have a *very* simple script written that displays the directory
listing of the current working directory, but I am having some
difficulty when I try to change folders. Basically, I have my $dir
variable set to this: --- $dir = getcwd() . "\\" . $nav; --- but for
some reason the script does not actually display the contents of the
directory if you change from the directory the script is located in.
Here is my code if someone is willing...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |