?
Solved

Auto-expand nodes in Treeview on Search

Posted on 2008-11-05
3
Medium Priority
?
1,112 Views
Last Modified: 2013-12-26
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.
0
Comment
Question by:tvtech
  • 2
3 Comments
 
LVL 22

Accepted Solution

by:
danaseaman earned 2000 total points
ID: 22892299
Use the Node Key or Index and call this code:

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

Author Comment

by:tvtech
ID: 22892383
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.
0
 

Author Closing Comment

by:tvtech
ID: 31513765
Whoops! Didn't close the nodes first! :-) Thanks danaseaman.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

621 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question