TreeList - how to get last child node of the current selected parent node?

1.4k Views Asked by At

I have created TreeList in Windows form and I added up and down buttons .In treelist there are lot of parent nodes with child nodes. Once expand a parent node , having child nodes and the child node is also a parent node. I want to get the count value of child node for current selected Parent Node.

Please Guide me solve this issue.

Thanks and regards

Saravanan

2

There are 2 best solutions below

6
Phylyp On

The SelectedNode property of a TreeView object returns the currently selected node.

For any node in a tree view (including the one returned by SelectedNode), the LastNode property returns the last child node under it.

In general, it would be beneficial for you to study all the properties and methods of a class that you're working on, to discover is behaviours. For instance in this case, looking at the TreeView class and TreeNode class gives you the information required to navigate a tree view.

0
User6667769 On

In my task ,I searched a lot of process.But there is no need to find out the count of child or parents nodes ..there is a predefined function in c#.which is used to move all over the in the treelist nodes.

TreeList.MoveNextVisible();

Treelist.MovePrevVisible();

or

TreeList.MoveNext();

TreeList.MoveNextVisible();

or

TreeList.Move();

TreeList.Move();

Once expand nodes in treelist,these prededined fuction will move in to their parents and its child nodes