table筛选后的一列日期,如何实现treeview,并且以月或者季度归类排序?我目前的方法比较烦琐:
先提取日期列,然后从中再提取月,在逐一增加第一级node,然后在判断日期在不在月里面并增加二级node。
循环了3次,有没有什么高效的方法?
For i As Integer = 0 To CurrentTable.Rows.count
If timelist.Contains(CurrentTable.Rows(i)(CurrentTable.ColSel))=False Then
timelist.Add(CurrentTable.Rows(i)(CurrentTable.ColSel))
End If
Next ''先把筛选后的当列日期提取出来
Dim monthlists As new List (of Date)
For Each times As Date In timelist
If monthlists.Contains(times.Month)=False Then
monthlists.add(times.month)
End If
Next ‘’把日期列的月份提取出来。
Dim nd As WinForm.TreeNode
For Each monthlist As Date In monthlists
nd=tv.nodes.add(monthlist)
For Each times in timelist
if 如果日期在月度
nd.nodes.Add。。。。
endif
Next