此主题相关图片如下:目录树降序.png
想要降序排 大的号码在第一行 先谢谢啦:D
Dim trv As WinForm.TreeView = e.Form.Controls("TreeView1")
trv.BuildTree(gt, "Job|Serviceitem")
trv.StopRedraw
For Each nd As WinForm.TreeNode In trv.AllNodes
Dim fl1 As String = nd.DataRow("Job")
Dim fl2 As String = nd.DataRow("Serviceitem")
Select Case nd.Level
Case 0
nd.Text = nd.text & "(" & gt.Compute("Sum(行数)", "Job='" & fl1 & "'") & "条)"
Case 1
nd.Text = nd.text & "(" & gt.Compute("Sum(行数)", "Job='" & fl1 & "' and Serviceitem='" & fl2 & "'") & "条)"
End Select
Next
trv.Nodes.Insert("[显示所有行]", "[显示所有行(" & Val(gt.Compute("Sum(行数)")) & "条)]", 0)
trv.ResumeRedraw