Solved

ActiveX Tree Control

Posted on 1998-08-15
3
283 Views
Last Modified: 2006-11-17
I'm trying to get data from several queries onto one display, and would like to present all of the data on a tree control. Right now, I can't even figure out how to populate the tree, and online help has not been of any assistance. I'm left with what seems to be a big, blank, textbox. Can anyone please give me a little help, or give me a url of a place that can be of some assistance? Thank you.
0
Comment
Question by:behrang
  • 2
3 Comments
 
LVL 5

Accepted Solution

by:
tuvi earned 100 total points
ID: 1959290
You use the control's Nodes property which is itself a Nodes collection. The Nodes collection have the Add method to add object to it. Refer to online help for the syntax.
0
 

Author Comment

by:behrang
ID: 1959291
The only help of syntax that I found where .root, .parent, etc. Am I on the right track?
0
 
LVL 5

Expert Comment

by:tuvi
ID: 1959292
I know it is tough to get into the right help topic involving ActiveX control (blame it on Microsoft). Anyway, this is how I get to the right topic:

Put your cursor on the Style property of the Treeview control. Press F1. The Help on Style Property will display on screen. Now click on Applies To and choose Node Object / Nodes Collection. You now have the help on the Nodes Collection. Click on Methods and choose Add Method (Nodes Collection). And there you have the right help on the Add syntax.

Here is my example of how you use the Add method to your control. I name the TreeView control as "ctTree".

Private Sub Form_Load()
  Dim colNodes As Nodes
  Dim curNode As Node
 
  Set colNodes = ctTree.Nodes
  colNodes.Add , tvwFirst, "Root", "The Root"
  colNodes.Add "Root", tvwChild, "FirstRootChild", "First Level / First Item"
  colNodes.Add "Root", tvwChild, "SecondRootChild", "First Level / Second Item"
  colNodes.Add "FirstRootChild", tvwChild, "FirstRootChild-1", "Second Level"
End Sub
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This article describes two methods for creating a combo box that can be used to add new items to the row source -- one for simple lookup tables, and one for a more complex row source where the new item needs data for several fields.
AutoNumbers should increment automatically, without duplicates.  But sometimes something goes wrong, and the next AutoNumber value is a duplicate.  This article shows how to recover from this problem.
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

733 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