View Single Post
  #1 (permalink)  
Old Jan 15th, 2007, 14:25
karinne's Avatar
karinne karinne is offline
SuperMember

SuperMember
Join Date: Jan 2007
Location: You know where
Age: 31
Posts: 4,617
Thanks: 0
Thanked 0 Times in 0 Posts
Tree-view hierarchie

.NET 2.0 using VS2005

I'm trying to get this tree-view working properly.

Here's the directory structure on my c: in a specific folder

Code: Select all
- Active
- Archive
  |
  |-- 04-05
  |-- 05-06
  |-- 06-07
Here's my code right now.

Code: Select all
For Each _d As String In Directory.GetDirectories("C:\Change Request\")

            Dim _folder As String = _d.Substring(_d.LastIndexOf("\") + 1)
            tvListFolders.Nodes.Add(_folder)

            Dim ThisDirectory As String = _folder

            For Each _dd As String In Directory.GetDirectories("C:\Change Request\" & ThisDirectory)

                Dim _dfolder As String = _dd.Substring(_dd.LastIndexOf("\") + 1)
                tvListFolders.Nodes.Add(_dfolder)

            Next

        Next
And this is what display (see attachment) ... Now ... how do I get the 04-05, 05-06 and 06-07 folder moved under the Archived folder? instead of under "root"?

I would've thought the second for loop in there would give me that but .... obviously that didn't work. I think I need to assign something as parent but ... I'm new at .NET so ... explanation and help would be greatly appreciated.

Thanks
Attached Images
File Type: jpg tree-view.jpg (28.4 KB, 48 views)
Reply With Quote