I need to be able to add nodes to a treeview at runtime but I dont know how many I need to add before I run the program. Here is what happends, I read a txtfile then I certain info from that textfile and then I need to add the info into a treeview. I have the first part working fine but im not sure how to add the strings to a treeview here is the code im using now
vb Code:
  1. Dim root1 As TreeNode = New TreeNode("root1Text")
  2.         Dim root2 As TreeNode = New TreeNode("root2Text")
  3.         Dim sub1 As TreeNode = New TreeNode("sub1Text")
  4.         Dim sub2 As TreeNode = New TreeNode("sub2Text")
  5.         TVOpen.Nodes.Add(root1)
  6.         TVOpen.Nodes.Add(root2)
  7.         root1.Nodes.Add(sub1)
  8.         root1.Nodes.Add(sub2)