I am trying to read all the nodes within a treeview in VB.NET, the tree structure is sort of like this:
The coding I am using is :
Private Sub RecurseNodes(ByVal col As TreeNodeCollection)
For Each tn As TreeNode In col
'If tn.Nodes.Contains(tn) = True Then
If (tn.IsExpanded And tn.Nodes.Count > 0) Or (Not tn.IsExpanded And tn.Nodes.Count = 0 And tn.PrevVisibleNode.Text = "") Then
gaORU(o, r, u) = tn.Text + ", NULL" + ", NULL"
gaORU(o, r, u) = "NULL, " + tn.Text + ", NULL"
Private Sub Test()
The error message pop up when the line read the line of tn.PrevVisibleNode.text, anyone knows how to solve this problem, read the first node of 'xxx' no problem, only when it reads the second node 'aaa', the reason I did this is trying to build up an array, which I can use the data inside the array for stored procedure to save the treeview nodes data into the SQL table?
I seached MSDN and google, just can't find any sample as far as how to save the treeview nodes data directly into SQL table, most samples are to save treeview nodes into XML file, I would assume it should be used as a bridge to save XML data into SQL table, anyone has any suggestions? Thank you in advance.