title: Populate a multilevel TreeView
body: <p>I try to populate a treeview with C#.
  My data are:  </p>
  
  <pre><code>level   data  
  1       xxxx  
  2       yyyy  
  3       aaaa  
  2       rrrr  
  1       oooo  
  </code></pre>
  
  <p>I would like something like :  </p>
  
  <pre><code>xxxxx  
  _yyyy  
  __aaaa  
  _rrrrr  
  ooooo  
  </code></pre>
  
  <p>I used some code like this :  </p>
  
  <pre><code> for (int index = 0; index &lt; dt.Rows.Count; index++)
   {
      TreeNode newNode = new TreeNode(dt.Rows[index]["Item"].ToString());
      treeView1.Nodes.Add(newNode);
      for (int j = index; j &lt; dt.Rows.Count; j++)
      {
         TreeNode newNode1 = new TreeNode(dt.Rows[j]["Item"].ToString());
         newNode.Nodes.Add(newNode1);
         // treeView1.SelectedNode.Nodes.Add(newNode1);
      }
   }    
  </code></pre>
  
  <p>But the result is a poor one. I can see only 2 levels.</p>
  
  <p>I know that I need something like a recursive function, but I do not know how to go through the tree and come back to the root.  </p>