Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Treeview Control - specifying children with grand-children
Message
 
To
All
General information
Forum:
Visual Basic
Category:
Coding, syntax & commands
Title:
Treeview Control - specifying children with grand-children
Miscellaneous
Thread ID:
00644117
Message ID:
00644117
Views:
48
Hi - I am trying to use the treeview control to create a navigation aid for an app I am working on... For ease of adding and removing menu items I am keeping the data for my treeview control in a database table - so I have this in the table...
na_primary - primary key an integer
na_group - character - the group to which the node belongs
na_topnode - logical - whether the node is a top level one
na_name - char - the name of the node that appears as text
na_graphic - char - the name of the graphic that appears

I have the graphics in an image list...

I use this code to generate the treeview


Dim nodX As Node ' create a tree

For intLoop = 1 To rsNav.RecordCount
strName = Trim(rsNav!na_name)
strGroup = Trim(rsNav!na_group)
strGraphic = Trim(rsNav!na_graphic)
'test if it's a top node
If rsNav!na_topnode = True Then
Set nodX = myTree.Nodes.Add(, , strGroup, strName, strGraphic)
Else
Set nodX = myTree.Nodes.Add(strGroup, tvwChild, strName, strName, strGraphic)
'Set nodX = myTree.Nodes.Add(strGroup, tvwChild, strName, strName, strGraphic)
End If

rsNav.MoveNext
Next intLoop

I get an error "Key is not unique in collection" and I know that it is caused by this...

I have a top node called "Contacts" and nodes below that are all of group "con" one of them is "Records"

but I also want to specify "Records" under other nodes ie. top node "Stock" with "Records" under it...

I have tried all sorts of things to get it work but no joy - I have got this working with VFP but the it seems I need a missing ingredient with VB...!

thanks
Chris Maiden
Email
Web
Next
Reply
Map
View

Click here to load this message in the networking platform