Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sort TreeView Content in descending order

Status
Not open for further replies.

miou

Programmer
Nov 26, 1999
3
0
0
CA
My tree views are sorted in ascending order.&nbsp;&nbsp;Anyone know how to do it in descending order?<br><br>Here is what my code does .. any suggestions?<br><br>Private Sub SortTreeCurrentClaim()<br>On Error GoTo Err_SortTreeCurrentClaim<br>'&nbsp;&nbsp;*******************<br>'&nbsp;&nbsp;Local Declaration<br>'&nbsp;&nbsp;*******************<br>&nbsp;&nbsp;&nbsp;Dim nodTemp As Node&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'the new claim node<br>&nbsp;&nbsp;&nbsp;Dim cnodTemp As Nodes&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'the treClaimCurrent.nodes collection<br>&nbsp;&nbsp;&nbsp;Static intNodIndex As Integer&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'the index of the new claim node quicker than a for each<br>&nbsp;&nbsp;&nbsp;&nbsp;<br>'&nbsp;&nbsp;***************<br>'&nbsp;&nbsp;Local Constants<br>'&nbsp;&nbsp;***************<br>&nbsp;&nbsp;&nbsp;Const PROC_NAME = &quot;SortTreeCurrentClaim&quot;<br>'&nbsp;&nbsp;*********<br>'&nbsp;&nbsp;Body<br>'&nbsp;&nbsp;********<br>&nbsp;&nbsp;&nbsp;objErr.TraceIn (MODULE_NAME & &quot; -&quot; & PROC_NAME)<br><br>&nbsp;&nbsp;&nbsp;If intNodIndex = 0 Then intNodIndex = 2 <br><br>' at the beginning the new claim index is always 2 because&nbsp;&nbsp;it's in the initClaimTree<br><br>&nbsp;&nbsp;&nbsp;Set cnodTemp = treClaimCurrent.Nodes<br>&nbsp;&nbsp;&nbsp;cnodTemp(1).Sorted = True&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'sort the tree<br>&nbsp;&nbsp;&nbsp;cnodTemp.Remove (intNodIndex)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'remove the nod<br>&nbsp;&nbsp;&nbsp;Set nodTemp = cnodTemp.Add(1, tvwChild) 'put the nod at the beginning<br>&nbsp;&nbsp;&nbsp;nodTemp.text = strLoadString(1313)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'&quot;New Claim&quot;<br>&nbsp;&nbsp;&nbsp;nodTemp.Tag = &quot;Claim -1&quot;<br>&nbsp;&nbsp;&nbsp;nodTemp.Image = &quot;leaf&quot;<br>&nbsp;&nbsp;&nbsp;intNodIndex = nodTemp.Index<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>Exit_SortTreeCurrentClaim:<br>&nbsp;&nbsp;&nbsp;objErr.TraceOut<br>&nbsp;&nbsp;&nbsp;Exit Sub<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>Err_SortTreeCurrentClaim:<br>&nbsp;&nbsp;&nbsp;Call objErr.DisplayErrMessage(itbdll.Language, True, _<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;vbInformation, gstrTitle & MODULE_NAME & &quot;-&quot; & PROC_NAME)<br>&nbsp;&nbsp;&nbsp;Resume Exit_SortTreeCurrentClaim<br>End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top