Pete below is code I used to Expand and collapse a treview control where the
tree is left on the first node when done.
Private Sub cmdCollapse_Click()
' Purpose Collapse all nodes in the Tree
Dim i As Integer
If tvwGoalBank.Nodes.Count > 0 Then
DoCmd.Hourglass True
For i = 1 To tvwGoalBank.Nodes.Count
tvwGoalBank.Nodes(i).Expanded = False
Next
DoCmd.Hourglass False
tvwGoalBank.Nodes(1).EnsureVisible
tvwGoalBank.Nodes(1).Selected = True
tvwGoalBank.SetFocus
End If
End Sub
Private Sub cmdExpand_Click()
' Purpose Expand all nodes in the Tree
Dim i As Integer
If tvwGoalBank.Nodes.Count > 0 Then
DoCmd.Hourglass True
For i = 1 To tvwGoalBank.Nodes.Count
tvwGoalBank.Nodes(i).Expanded = True
Next
DoCmd.Hourglass False
tvwGoalBank.Nodes(1).EnsureVisible
tvwGoalBank.Nodes(1).Selected = True
tvwGoalBank.SetFocus
End If
End Sub
Ron W
"Larry Daugherty" <La********************@verizon.net> wrote in message
news:IV**************@nwrddc03.gnilink.net...
Hi Pete,
I plugged in another newsgroup where you're likely to get an answer from
Alex Dybenko. He's all over that Treeview stuff.
HTH
--
-Larry-
--
"PeteCresswell" <Go**********@FatBelly.com> wrote in message
news:74**************************@posting.google.c om... I wrote some code to let the user toggle between all expanded and all
collapsed, but it tends to leave the view of the tree where I'd rather
not have it.
Can't find anything via Google...
Anybody know how to force the view of the tree to a certain node...or
at least to the top?