Hello,
How can i programmatically create a treeview consisting of several nodes and each node has several children.
I want to read the nodes and children from a table and fill them accordingly, so how can i do this?
thank you
Hiba
Printable View
Hello,
How can i programmatically create a treeview consisting of several nodes and each node has several children.
I want to read the nodes and children from a table and fill them accordingly, so how can i do this?
thank you
Hiba
Creating a TreeNode object is just like creating any other object, i.e. invoke a constructor with the New key word and then set the appropriate properties. You can then Add that TreeNode to the Nodes collection of a TreeView or another TreeNode.
As is usually the case, I would suggest that you create your populated TreeView in the designer and then look at the code that gets generated. You can then write similar code.
You might also like to take a look at this. It might not be exactly what you want but it won't be far off, so adapting to your needs shouldn't be too hard.