Results 1 to 3 of 3

Thread: Treeview control

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Feb 2000
    Location
    Dunmow,Essex,England
    Posts
    898

    Treeview control

    Hi,

    I'm having trouble trying to create child nodes.

    TreeView1.ShowPlusMinus = True
    TreeView1.Nodes.Add(New TreeNode("Structures"))
    With objDS
    For i = 0 To .Tables(0).Rows.Count() - 1
    Row = .Tables(0).Rows(i)
    TreeView1.Nodes.Add(New TreeNode(Row.Item("ProductCode") + " - " + Row.Item("ProductDescription")))
    Next

    All I am trying to do is to create a top level node called "Structures" and then create a child node for each of my items, but they always seem to be on the same level as the top node.

  2. #2
    New Member
    Join Date
    Sep 2004
    Posts
    11
    You can make the changes as I have suggested (shown bold)

    TreeView1.ShowPlusMinus = True
    TreeView1.Nodes.Add(New TreeNode("Structures"))
    Code:
    
    Dim TopNode As TreeNode = TreeView1.Nodes.Item(0)
    
    With objDS
    For i = 0 To .Tables(0).Rows.Count() - 1
    Row = .Tables(0).Rows(i)
    Code:
    
    TopNode.Nodes.Add(New TreeNode(Row.Item("ProductCode") + " - " + Row.Item("ProductDescription")))
    
    Next
    Last edited by pradeepc; Oct 4th, 2004 at 04:40 AM.

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Feb 2000
    Location
    Dunmow,Essex,England
    Posts
    898
    Thanks,

    though TopNode.Add........... should be

    TopNode.Nodes.Add now works.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width