Auto-expand nodes in Treeview on Search

tvtech
tvtech used Ask the Experts™
on
Hi.

My code allows a user to search for a Product Name, which is contained within a Treeview Node. If the Nodes are NOT expanded, I need the code to auto-expand the Parent Node and it's Children which correspond with a successful search.

    My Treeview looks something like this:

        + Parent
                   -Child
                          -Child
                                 -Child

Can anyone help with some code, please.

Thanks.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Use the Node Key or Index and call this code:

TreeView1.Nodes.Item("nodSub16").EnsureVisible

Author

Commented:
dabaseaman, thanks, but that expands all nodes under that Parent. I only the branch that contains my Product Name to expand.

Example:

        + Parent
                   -Child
                          -Child
                                 -Child

        + Parent
                   -Child
                          -Child
                                 -Child

        + Parent <-------- Only want this branch to open
                   -Child
                          -Product Name <---- Search finds correct Product Name.
                                 -Child

Thanks.

Author

Commented:
Whoops! Didn't close the nodes first! :-) Thanks danaseaman.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial