Treeview Events and References

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
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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
tk3Author Commented:
Thanks for the input, but I already found another article that described in detail how to do this, suggesting a naming convention, etc.
tk3Author Commented:
How do I close a question? I've never had to do that and don't know how.
Steve BinkCommented:
PAQed with points refunded (500)

Community Support Moderator

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.