Results 1 to 4 of 4

Thread: clear a specific node

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Mar 2006
    Posts
    977

    clear a specific node

    Hi
    I have a treeview containing many nodes.Each node contains its sub nodes.
    For example my treeview look like:
    Item1
    Item11
    Item12
    Item2
    Item3
    Item4

    What should I do if I want to delete Item1 Node and all its subnodes(item11 and item12) without deleting the other nodes?
    thanks

  2. #2
    Addicted Member
    Join Date
    Sep 2005
    Posts
    138

    Re: clear a specific node

    VB Code:
    1. For i = 1 to TreeView.Nodes.Count
    2.      If TreeView.Node.Item(i).Text = "Item01" Then
    3.          TreeView.Node.Remove i
    4.      End If
    5. Next i
    This would remove a specific item text

  3. #3
    Addicted Member
    Join Date
    Sep 2005
    Posts
    138

    Re: clear a specific node

    I'm not sure about sub nodes but it might be like the following

    VB Code:
    1. TreeView.Node.Remove TreeView.Node(i).Children

  4. #4
    Junior Member Pascal.Scholtes's Avatar
    Join Date
    Jun 2005
    Location
    Saarbrücken / Germany
    Posts
    26

    Re: clear a specific node

    You don't have to delete SubItems if the Parent will be deleted.
    Look busy. Jesus is coming.

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