以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- 想通过遍历目录树取对应表中列的值的问题? (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=69886) |
||||
-- 作者:zgjmost -- 发布时间:2015/6/12 11:42:00 -- 想通过遍历目录树取对应表中列的值的问题? 想通过遍历目录树取对应表中列的值存入一个集合中,再通过遍历集合打签到单
我想通过目录树如9日08:00的201教室,对应“考试数据表”中的“日期短时间教室”列的值,遍历后将
但不知怎样遍历这个树的第三节点为真,取到“考试数据表”中的“日期短时间教室”列的值,请大师帮忙!
实例如下:
具体代码在窗体 签到单打印中,请大师指点! |
||||
-- 作者:大红袍 -- 发布时间:2015/6/12 12:14:00 -- Dim nms As String() = {"短日期","起始时间","教室"} \'指定生成目录树的各列 Dim qts As String() = {"\'","\'","\'"} \'指定将各列的值括起来的符号,这里都是字符型,所以都是单引号 Dim trv As WinForm.TreeView = e.Sender Dim flt As String For Each nd In e.node.allNodes \'清除子节点的选中标记 nd.Checked = False Next nd = e.Node.ParentNode Do While nd IsNot Nothing \'清除父节点的选中标记 nd.Checked = False nd = nd.ParentNode Loop For Each nd In trv.AllNodes If nd.Level > 0 Then If nd.Checked Then Dim rts() As String = nd.FullPath.Split("\\") Dim val As String = "" For i As Integer = 1 To rts.length - 1 If val > "" Then val = val & " And " End If val = val & nms(i-1) & " = " & qts(i-1) & rts(i) & qts(i-1) Next If flt > "" Then flt = flt & " Or (" & val & ")" Else flt = val End If End If End If Next msgbox(flt) |