Foxtable(狐表)用户栏目专家坐堂 → 按季度归类的treeview


  共有1589人关注过本帖树形打印复制链接

主题:按季度归类的treeview

帅哥哟,离线,有人找我吗?
lur320
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:四尾狐 帖子:969 积分:8532 威望:0 精华:0 注册:2015/8/12 16:28:00
按季度归类的treeview  发帖心情 Post By:2018/3/22 15:19:00 [显示全部帖子]

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


 回到顶部