I'm not a experience vb.net programmer so I'm struggling with some code related to treeview node implementation:
My goal is to implement a hierarchical and editable structure related to a "Bill of Materials" (e.g. a house has a foundation, walls, roof,.. and walls has stones, plaster,....) The number of levels of this hierarchical structure is (per definition) unknown.
I'm able to populate a treeview(1) with SQL data to multiple but a fixed number of levels. The code I've implemented:
TreeView1.Nodes.Add(var01, var01).Nodes.Add(var02, var02)
(example 2 levels)
where var01
and var02
the names within the structure are (e.g. House-Wall). The Node structure is build using a "for - next loop"
Officious by adding ".Nodes.Add(varXX, varXX)
" I'm able to extend the level of the structure.
My goal however is to implement "the adding of .Nodes.Add(varXX, varXX)
" through a loop make the number of hierarchical levels flexible.
I tried to convert Treeview1.Nodes
... to a string and build a (overall) string through a loop. Then I tried to convert this string to the treeview control. This principle doesn't unfortunately work.
Any advice would be appreciated.