Dealy

Dealy

  • NA
  • 213
  • 0

Multi-level treeView from a dataset

Oct 7 2013 6:48 AM

Hello,

I am building a Windows Forms application with C#.

I have created a table with these columns: (FolderID, FolderName, ParentFolder)

This is an example of how records have been stored:
================================
FolderID            FolderName        ParentFolder
================================
      1                      Folder1                   
      2                      Folder2                  
      3                      Folder3                1   
      4                      Folder4                1     
      5                      Folder5                2

And this is how I need to view the tree:

-Folder1
   --Folder3
   --Folder4
-Folder2
  --Folder5

How can I add data to the treeView as shown above, given that database records are already in a datable.

Thank you in advance.


Answers (6)