jas777
asked on
TREEVIEW: set focus to 1st node after populating
hello-
this is a stupid question, but for some reason, when i populate my treeview from database entries, the treeview scrolls to the bottom.
basically, the top item(1st node) is not visible, unless you manually scroll back up.
Q: how do keep the focus on the first node, so it is visible after populating the treeview.
this is a stupid question, but for some reason, when i populate my treeview from database entries, the treeview scrolls to the bottom.
basically, the top item(1st node) is not visible, unless you manually scroll back up.
Q: how do keep the focus on the first node, so it is visible after populating the treeview.
Try: Treeview.Nodes(1).EnsureVi sible after you have loaded the treeview.
The treeview will scroll as it is loaded, nothing you can do about that, but you can set the first item as the selected item after the load completes, to resync the view
dave-
can you give me the syntax
can you give me the syntax
jas777
i think you should try and extend the length of the treeview
i think you should try and extend the length of the treeview
ASKER
i tried agriggs comment, and was unnsuccessful.
basically, my treeview is a certain size, and because after populating, the items in the treeview, require a longer treeview, the scrolling automatically occurs.
if you guys have an EXAMPLE of setting the selected item as the first node, i would really appreciate it.
basically, my treeview is a certain size, and because after populating, the items in the treeview, require a longer treeview, the scrolling automatically occurs.
if you guys have an EXAMPLE of setting the selected item as the first node, i would really appreciate it.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Note - you also use EnsureVisible only after the Treeview is fully populated.
For i = 0 To 100
Set nodX = TreeView1.Nodes.Add(1, tvwChild)
nodX.Text = List1.List(i)
Next i
Treeview1.Nodes(1).Selecte d = True
nodX.EnsureVisible ' Make sure the node is visible.
Set nodX = TreeView1.Nodes.Add(1, tvwChild)
nodX.Text = List1.List(i)
Next i
Treeview1.Nodes(1).Selecte
nodX.EnsureVisible ' Make sure the node is visible.
ASKER
thanks dude, you rule
I am just curious why
tvwMine.Nodes("Root").Ensu reVisible
works and
Treeview.Nodes(1).EnsureVi sible
doesn't? Ok, I give.
tvwMine.Nodes("Root").Ensu
works and
Treeview.Nodes(1).EnsureVi
doesn't? Ok, I give.
ASKER
agriggs, i apologize, but i didn't implement yours correctly. i used the index as 0, not 1 - as you reccommeded.
let me know how i can award you some points at least, and i will.
if you want me to post a "dummy" question just for you, let me know.
sorry man, my brain is on cloud 9
let me know how i can award you some points at least, and i will.
if you want me to post a "dummy" question just for you, let me know.
sorry man, my brain is on cloud 9