• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 970
  • Last Modified:

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
1 Solution
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

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now