By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,257 Members | 1,616 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,257 IT Pros & Developers. It's quick & easy.

How To Position A TreeView?

P: n/a
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?
Nov 13 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
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?

Nov 13 '05 #2

P: n/a
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?


Nov 13 '05 #3

P: n/a
RE/
tvwGoalBank.Nodes(1).EnsureVisible
tvwGoalBank.Nodes(1).Selected = True


BINGO!

Thanks.
--
PeteCresswell
Nov 13 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.