TreeView Folder-tree

  • Thread starter Thread starter Per Rollvang
  • Start date Start date
P

Per Rollvang

Hi All!

I have a little problem with calling a TreeView-function recursive to fill
it with folder-paths. I.e
c:\Windows\System32\ should be displayed
c
Windows
System32

Anybody that can help me out with some good code, or a link?

TIA

Per Rollvang
 
Per Rollvang said:
I have a little problem with calling a TreeView-
function recursive to fill it with folder-paths.

Here is a way to retrieve directories recursively. I'll leave the TreeView
side up to you.

using System.IO;
....
private static void RecurseSubDirs(DirectoryInfo dir)
{
DirectoryInfo[] subdirs = dir.GetDirectories();

for (int iSubDir = 0; iSubDir < subdirs.Length; iSubDir++)
{
Console.WriteLine(subdirs[iSubDir]);
RecurseSubDirs(subdirs[iSubDir]);
}
}

P.
 
Paul E Collins said:
Here is a way to retrieve directories recursively. I'll leave the TreeView
side up to you.
Hi Paul!

My problem is related to how I 'mount' subfolders on the right node object.
In this particular case, I got the paths as a strings, and just have to
parse it (string.Split) to get the subfolders..

Per
 
Back
Top