devxlogo

EnsureNodeIsVisible – Select a TreeView node and ensure it is visible

EnsureNodeIsVisible – Select a TreeView node and ensure it is visible

' select a treevide node and ensure it is visible' by expanding all its parent nodes and bringing the node' in the visible portion of the controlSub EnsureNodeIsVisible(ByVal node As TreeNode)    Dim tvw As TreeView = node.TreeView    tvw.SelectedNode = node    ' expand this node and all its ancestors    Do Until node.Parent Is Nothing        node = node.Parent        node.Expand()    Loop    tvw.SelectedNode.EnsureVisible()End Sub

devx-admin

Share the Post: