Coming from Win32, I am having bit of an issue or a problem trying to work with treeview for .NET. I have searched online, msdn library and stackoverflow and none seem to help me.
Could someone, please, show me how you can use Treeview to create node, create childnode, set data or object, retrieve object, check its level, etc…
Example code would be greatly appreciated. Thank you.
1) Create a root Node
use the
Nodes.Addmethod2) Create a Child Node, get the instance to the parent node and uses the
Nodes.Add3) To store an object in anode use the
Tagproperty of the Node4) To Retrieve the object use the tag property and cast the value.
5) to get the level, chek the
Levelproperty of the node.Check this simple code :