Articles in this section
Category / Section

How to scroll TreeNode programmatically in WinForms TreeView?

3 mins read

Selection node

In the WinForms TreeView, to scroll a particular TreeNodeAdv or to ensure that it is visible programmatically, you can use the functions BringIntoView and EnsureVisible.

C#

//Shows the parent node of the selected node.
this.treeViewAdv1.SelectedNode.Parent.BringIntoView();
//Shows the particular node.
this.treeViewAdv1.Nodes[0].Nodes[this.treeViewAdv1.Nodes[0].Nodes.Count - 1].BringIntoView();
//EnsureVisible function also used to show the parent node of the selected node.
this.treeViewAdv1.EnsureVisible(treeViewAdv1.SelectedNode.Parent);

VB

'Shows the parent node of the selected node.
Me.treeViewAdv1.SelectedNode.Parent.BringIntoView()
'Shows the particular node.
Me.treeViewAdv1.Nodes(0).Nodes(Me.treeViewAdv1.Nodes(0).Nodes.Count - 1).BringIntoView()
'EnsureVisible function also used to show the parent node of the selected node
Me.treeViewAdv1.EnsureVisible(treeViewAdv1.SelectedNode.Parent)
'EnsureVisible function also used to show the particular node
Me.treeViewAdv1.EnsureVisible(Me.treeViewAdv1.Nodes(0).Nodes(treeViewAdv1.Nodes(0).Nodes.Count - 1))

 

Show the scrolling view and selected the particular node WinForms TreeView

Samples:

C#: https://www.syncfusion.com/downloads/support/directtrac/129875/ze/TreeViewAdv_BringIntoView-1537746265

VB: https://www.syncfusion.com/downloads/support/directtrac/129875/ze/TreeViewAdv_BringIntoView_VB-360800057

Reference link: https://help.syncfusion.com/windowsforms/treeview/treenodeadvcustomization#nodeselection

 


Conclusion

I hope you enjoyed learning how to choose the best grid in WinForms Grid Control.

You can refer to WinForms Grid feature tour page to know about its other groundbreaking feature representations and documentation, and how to quickly get started for configuration specifications. You can also explore our WinForms Grid example to understand how to create and manipulate data.

For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls.

If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forumsDirect-Trac, or feedback portal. We are always happy to assist you!

 

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment
Access denied
Access denied