I'm currently writting a program to catalog my CD's to a MySQL database. I don't have a problem with the SQL part, what gets me is the nodes in treeview. I can't figure out how to made dynamic nodes to represent the file tree.
I wondered how I'd go about adding nodes so that they could go an infinate set of branches in and down, much like a file system.
So far I tryed to long way which was just one line, but it seems impossible to get it to work dynamicaly as there isn't a way to process VB code after the compile (I wish I could use a string to build the huge node.)
After looking through the forums, I found a topic that sort of addressed the problem but all I could get from it was this:
Which is ok if I didn't need a sub branch. What I'd like to do is build nodes by using a path syntax. like putting in the following.
Is there any way to make that happen? ^-^ If so, that would rock.
I wondered how I'd go about adding nodes so that they could go an infinate set of branches in and down, much like a file system.
So far I tryed to long way which was just one line, but it seems impossible to get it to work dynamicaly as there isn't a way to process VB code after the compile (I wish I could use a string to build the huge node.)
VB.NET:
tvDirectory.Nodes.Add([COLOR="Red"]"Root"[/COLOR]).Nodes.Add([COLOR="Red"]"Test"[/COLOR]).Parent.Nodes.Add([COLOR="Red"]"Test2"[/COLOR])
After looking through the forums, I found a topic that sort of addressed the problem but all I could get from it was this:
VB.NET:
[COLOR="Blue"]Dim[/COLOR] tmpNode [COLOR="Blue"]As New[/COLOR] TreeNode
[COLOR="Blue"]For[/COLOR] i [COLOR="Blue"]As Integer[/COLOR] = 0 To 10
tmpNode = [COLOR="Blue"]New[/COLOR] TreeNode
tmpNode.Text = [COLOR="Red"]"Node"[/COLOR] & i
tvDirectory.Nodes.Add(tmpNode)
[COLOR="Blue"]Next[/COLOR]
Which is ok if I didn't need a sub branch. What I'd like to do is build nodes by using a path syntax. like putting in the following.
VB.NET:
[COLOR="Red"][root][/COLOR]
[COLOR="Red"][root][/color][B]\[/B][COLOR="Green"]dir1[/COLOR]
[COLOR="Red"][root][/color][B]\[/B][COLOR="Green"]dir1[/COLOR][B]\[/B][COLOR="Red"]dir2[/COLOR]
[COLOR="Red"][root][/color][B]\[/B][COLOR="Green"]dir1[/COLOR][B]\[/B][COLOR="Blue"]dir3[/COLOR]
[COLOR="Red"][root][/color][B]\[/B][COLOR="Green"]dir1[/COLOR][B]\[/B][COLOR="Blue"]dir3[/COLOR][B]\[/B][COLOR="DimGray"]dir4[/COLOR]
[COLOR="Red"][root][/color][B]\[/B][COLOR="Green"]dir1[/COLOR][B]\[/B][COLOR="DarkOrange"]dir5[/COLOR]
[COLOR="Red"][root][/color][B]\[/B][COLOR="SandyBrown"]dir6[/COLOR]
etc
Is there any way to make that happen? ^-^ If so, that would rock.