Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations dencom on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Treeview - Only show one Node

Status
Not open for further replies.

jw45

Programmer
May 27, 2005
56
US
I have a form when I open I fill a treeview control recursively. I want to be able to open this form by double-clicking on a value from another form and only displaying the node related to double-click value.

If this can't be done then can I open the form and move to and expand the node related to double-click value?

Can this be done and can someone help me with this?

Thanks,
JW
 
I can think of lots of alternatives for you. But first if you only want to display the one node why load the rest recursively first. Just load the one node

or you can navigate the nodes collection

for each node in treeview1.nodes
if me.node.key = whatever then
me.ensurevisible = true
end if
next
 
I should have mentioned that I am using Access 97.

I keep getting an error on 'ensurevisible'.

Is it for 2000 and above?
 
I use treeviews all the time with access 97. ensurevisible is part of the treeview object. The code I pasted was for example only. If you use object browser (press f2)and look up the properties for a treeview you will see its proper use.

if you attempted to just paste the example above then it would error

node.ensurevisible would be the proper use
node.selected is also something for you to look into.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top