title: VB.NET Treeview
body: <p>Ok, I have a treeview I am poulating from a database using a datatable. The query works and produces a datatable with two records. The field I use has the contents:</p>
  
  <ol>
  <li>sksorter\images\africa\9544\high resolution\</li>
  <li>sksorter\images\africa\9545\high resolution\</li>
  </ol>
  
  <p>I am trying to produce a tree</p>
  
  <p>sksorter</p>
  
  <p>-images</p>
  
  <p>--africa</p>
  
  <p>---9544</p>
  
  <p>----high resolution</p>
  
  <p>---9545</p>
  
  <p>----highresolution</p>
  
  <p>It works but it is missing the final high resolution node...and I am pretty sure it's becasue the method I am using does a find for each node before creating it, it then sees "high resolution" exisits and does not create it!!</p>
  
  <p>I am at a lost any ideas?? thanks!!</p>
  
  <pre><code>For Each dt As DataRow In dtData.Rows
      'load the node we are as the base node?      
      Dim stTemp As String()
      stTemp = dt.Item(0).ToString.Split("\")
      Dim otest As String
  
      For Each strNode As String In stTemp
          If strNode &lt;&gt; String.Empty Then
              'Index = Dir.LastIndexOf("\")
              otest = String.Empty
              otest += strNode + "\"
              Dim nodes As TreeNode() = trvFolders.Nodes.Find(otest, True) 
              If nodes.Length = 0 Then
                  If basenode Is Nothing Then
                      basenode = trvFolders.Nodes.Add(otest, strNode)
                  Else
                      basenode = basenode.Nodes.Add(otest, strNode)
                  End If
              Else
                  basenode = nodes(0)
              End If
          End If
      Next
  Next
  </code></pre>