Hi,

i created run time treeview. i do't know how to collects the datas from that treeview.

please send the syntax to me. i am searched in google but i m not get any relevant information.


Regards,

Karthikeyan S

what "data" are you trying to get?

You can get the text of the node with the following, but I am not shure if it is that what you want:

private void treeView1_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
        {
            TreeNode selectedNode = e.Node;
            if (selectedNode.Nodes.Count == 0) //we have no children 
            {
                     Console.WriteLine(selectedNode.Text);
             }
}

hi the above code is only for the selected node

i need to read all root node and their child node in the tree.

Then step through the nodes of the treeview, but its only going to show the text you put in.

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.