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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top