0
Answer

regarding treeview.is there anything that is missing?

swaroop bhave

swaroop bhave

14y
1.2k
1
Private Sub cmnuAddNode_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmnuAddNode.Click


    Dim nod As New TreeNode()


    nod.Text ="" 'user input

    nod.Tag =-1


    treeView1.SelectedNode.Nodes.Add(nod)

    treeView1.SelectedNode.ExpandAll()

 

End Sub


Private Sub FindByTag()

    Dim nodes As TreeNodeCollection = treeView1.Nodes

    Dim n As TreeNode

    For Each n In nodes

        FindRecursive(n)

    Next

End Sub

 

Private Sub FindRecursive(ByVal tNode As TreeNode)

 

    Dim tn As TreeNode

    For Each tn In tNode.Nodes


        If tn.tag = -1 Then

'here write your database insert

        End If


        FindRecursive(tn)

    Next

 

End Sub