Question: I have one text box which accepts the path of selected folder. And i need to display all sub folders present in that folder in a TreeView.

How can i do this?

Answer: 
```
string Path = @"C:\Temp Folder\";
string[] folders = System.IO.Directory.GetDirectories(Path, "*", System.IO.SearchOption.TopDirectoryOnly); 

       TreeNode treeNode = new TreeNode(Path);          
        TreeNode subNode;
        for (int i = 0; i < folders.Length; i++)
        {
            subNode = new TreeNode(folders[i].ToString());
            treeNode.Nodes.Add(subNode);            
        }
        treeView1.Nodes.Add(treeNode);  

```
I have done this in the past using VB.net (I will convert it for you shortly)
All you need is a recursive function

```
YourTreeViewControl.Nodes.Add("C:\Temp")
Recursive(@"C:\Temp", Tree.Nodes(0))

    void Recursive(string d, TreeNode nodePar)
    {
        DirectoryInfo dir = new DirectoryInfo(d);
        foreach (var item in dir.GetDirectories()) {
            Recursive(item.FullName, nodePar.Nodes.Add(item.Name));
        }
    }

```