|
-
May 17th, 2001, 01:49 PM
#1
treeview control
HI,
Is it possible to create a treeview dynamically on run time? The data to
create the treeview comes from a database and can differ from user to user.
Thanks in advance.
-
May 17th, 2001, 02:12 PM
#2
Re: treeview control
If yuo place the blank object on the form that you require then the branches can be created dynamically depending on the data to be displayed
-
May 17th, 2001, 02:12 PM
#3
Re: treeview control
sure is - you just have to some data to put in there. Hopefully, you're data will be user specific and have some sort of hierarchical structure that can be easily represented in the tree view control.
Look into adding things from a recordset first, then start dealing with the recursion - which will be required to build the tree correctly.
it's pretty easy, once you get used to the routines.
john
John Pirkey
MCSD
http://www.ShallowWaterSystems.com
http://www.stlvbug.org
John Pirkey
MCSD (VB6)
http://www.stlvbug.org
-
May 17th, 2001, 02:23 PM
#4
Re: treeview control
Thanks for your help.
Do you know where I could find some sample code that shows me how to create the treeview during run time?
-
May 17th, 2001, 04:07 PM
#5
Re: treeview control
Here's a very simple example:
Dim i as Integer
Dim nod as Node
Dim nod2 as Node
TreeView1.Style = tvwTreelinesPlusMinusText
TreeView1.LineStyle = tvwRootLines
for i = 1 to 10
set nod = TreeView1.Nodes.Add(, , , i & "Parent")
for j = 1 to 3
set nod2 = TreeView1.Nodes.Add(nod.Index, tvwChild, , "Child" & j)
for x = 1 to 2
TreeView1.Nodes.Add nod2.Index, tvwChild, , x & " grandchild"
next x
next j
next i
this will add some nodes and some child nodes and then some grandchildren nodes to a treeview named TreeView1.
You can use this as a guide to populating the treeview from a recordset. if you have questions, post them here and someone will help you.
hope this helps,
john
John Pirkey
MCSD
http://www.ShallowWaterSystems.com
http://www.stlvbug.org
John Pirkey
MCSD (VB6)
http://www.stlvbug.org
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|