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:afrog:
Re: How to manipulate treeview checkbox
Hello Guys,
Any solutions?
Thanks
Napoleon
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:
Private Sub Button1_Click(ByVal sender As Object, _
ByVal e As EventArgs) Handles Button1.Click
Me.FindCheckedNodes(Me.TreeView1.Nodes)
End Sub
Private Sub FindCheckedNodes(ByVal nodes As TreeNodeCollection)
For Each node As TreeNode In nodes
If node.Checked Then
MessageBox.Show(node.FullPath, "Checked")
End If
'This is the recursive call.
Me.FindCheckedNodes(node.Nodes)
Next
End Sub