Treeview Events and References

Posted on 2004-11-25
Last Modified: 2012-05-05
I am working with a Treeview for the first time, and would like to do the following:

I have a Treeview control on a form with a subform containing a tab control.

The tab control has tabs for Customer, Location, Service, and Visit. These correspond to the levels in my Treeview. The Customer, Location and Service tabs are full of simple text fields. The Visit tab contains a third-party calendar control showing the specific Visits for this Service.

I want to do two basic things:

1. When the user clicks on a node in the treeview, I want to detect what type of node that is, and display the relevant details about that node in the sub-form. If it is a Customer, I want to display the Customer information tab and hide the Location and Service tabs (I can handle that). If it is a Location, I want to display the Location tab, and hide the Customer and Service tabs, etc.

Q: How do I best figure out what type of node the user has clicked? Should I use a naming convention? Should I keep an array on the side and use an index value? Something else? Is there a property which tells me the level in the tree?

2. When the user clicks on the calendar control and chooses an appointment, I want to find the relevant customer, display all Locations and Services in the Treeview, and then move to the specific Visit corresponding to the one he just clicked.

Q: How do I locate a specific node within a tree? Do I use some kind of index value? How are these best tracked? An array outside the Treeview?

Other things which would be helpful would be a reference to all available properties and events within the Treeview, and sample code for doing things similar to the above.

Thanks very much. Ted
Question by:tk3

    Expert Comment

    Private Sub TreeView1_NodeClick(ByVal Node As Object)

    ' Code goes here and will befired when a node is clicked

    End Sub


    Private Sub TreeView1_NodeClick(ByVal Node As Object)

    IF Node.Text = "appointment" Then
    End If

    End Sub

    Author Comment

    Thanks for the input, but I already found another article that described in detail how to do this, suggesting a naming convention, etc.

    Author Comment

    How do I close a question? I've never had to do that and don't know how.
    LVL 50

    Expert Comment

    by:Steve Bink

    Accepted Solution

    PAQed with points refunded (500)

    Community Support Moderator

    Featured Post

    Why You Should Analyze Threat Actor TTPs

    After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

    Join & Write a Comment

    Most if not all databases provide tools to filter data; even simple mail-merge programs might offer basic filtering capabilities. This is so important that, although Access has many built-in features to help the user in this task, developers often n…
    Introduction When developing Access applications, often we need to know whether an object exists.  This article presents a quick and reliable routine to determine if an object exists without that object being opened. If you wanted to inspect/ite…
    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…

    754 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

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now