Results 1 to 3 of 3

Thread: How to manipulate treeview checkbox

  1. #1

    Thread Starter
    New Member
    Join Date
    Feb 2009
    Posts
    7

    Cool How to manipulate treeview checkbox

    Hi, everyone.
    I had a treeview that had checkbox and its content is like file explorer. the checkbox is check when users want to delete that files or directory, after the selection, press the command button then all selection will be process (on this case deletion) how that to be code?
    Thanks
    Napoleon

  2. #2

    Thread Starter
    New Member
    Join Date
    Feb 2009
    Posts
    7

    Re: How to manipulate treeview checkbox

    Hello Guys,
    Any solutions?
    Thanks
    Napoleon

  3. #3
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: How to manipulate treeview checkbox

    A tree is a recursive structure so the way to traverse a TreeView is almost always using recursion:
    vb.net Code:
    1. Private Sub Button1_Click(ByVal sender As Object, _
    2.                           ByVal e As EventArgs) Handles Button1.Click
    3.     Me.FindCheckedNodes(Me.TreeView1.Nodes)
    4. End Sub
    5.  
    6. Private Sub FindCheckedNodes(ByVal nodes As TreeNodeCollection)
    7.     For Each node As TreeNode In nodes
    8.         If node.Checked Then
    9.             MessageBox.Show(node.FullPath, "Checked")
    10.         End If
    11.  
    12.         'This is the recursive call.
    13.         Me.FindCheckedNodes(node.Nodes)
    14.     Next
    15. End Sub
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

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