Seven price
asked on
treeview sort
Can you use SortDirection.Descending for a treeview if so how.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
this almost seem to work but only with 2 nodes with 3 doesn't work.
Private Sub SortTreeNodes(treeNodes As TreeNodeCollection)
Dim sorted = True
For Each treeNode As TreeNode In treeNodes
SortTreeNodes(treeNode.ChildNodes)
Next
Do
sorted = True
For i = 0 To treeNodes.Count - 1
Dim treeNode1 = treeNodes(i)
Dim treeNode2 = treeNodes(i)
Dim treeNode3 = treeNodes(i + 1)
' If treeNode1.Text.CompareTo(treeNode3.Text) < 0 Then
treeNodes.RemoveAt(i)
treeNodes.RemoveAt(i)
treeNodes.RemoveAt(i)
treeNodes.AddAt(i, treeNode1)
treeNodes.AddAt(i, treeNode2)
treeNodes.AddAt(i, treeNode3)
Response.Write(i)
' End If
Next
Loop While Not sorted
End Sub
ASKER
tks
ASKER
I tryied both links implement the code nothing.