I have a rootnode and its value is (1) then it's childnode is (2,3) I add childnodes to (2) but on (3) I do not know. how can I add childnodes to 3?

What do you mean by (2,3)? Do you mean two child nodes at the same level as in

node 1
|
-- node 2
|
-- node 3

Can you please show us the code you are using? To ad nodes to any node in the tree you just reference that node's Nodes collection. Try this with an empty tree

    Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click

        'add a root node, then add two child nodes

        trvTree.Nodes.Add(New TreeNode("1"))
        trvTree.Nodes(0).Nodes.Add(New TreeNode("2"))
        trvTree.Nodes(0).Nodes.Add(New TreeNode("3"))

        'add a child node under node "2" and one under node "3"

        trvTree.Nodes(0).Nodes(0).Nodes.Add(New TreeNode("2.1"))
        trvTree.Nodes(0).Nodes(1).Nodes.Add(New TreeNode("3.1"))

        trvTree.ExpandAll()

    End Sub

You can also name a node. For example, let's give the node a name equal to the value. Then you can refer to nodes by name as in

    Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click

        'add a root node, then add two child nodes

        trvTree.Nodes.Add(MakeNode("1"))
        trvTree.Nodes("1").Nodes.Add(MakeNode("2"))
        trvTree.Nodes("1").Nodes.Add(MakeNode("3"))

        'add a child node under node "2" and one under node "3"

        trvTree.Nodes("1").Nodes("2").Nodes.Add(MakeNode("2.1"))
        trvTree.Nodes("1").Nodes("3").Nodes.Add(MakeNode("3.1"))

        trvTree.ExpandAll()

    End Sub

    Private Function MakeNode(value As String) As TreeNode
        Dim node As New TreeNode(value)
        node.Name = value
        Return node
    End Function

Thank You for the idea.. I got it ;)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.