Rss & SiteMap
Foxtable(狐表) http://www.foxtable.com
下载信息 [文件大小: 下载次数: ] | |
点击浏览该文件:目录树 请引入到订单表的新窗口中.rar |
俺把代码贴出来吧:
Dim dl as string = "产品|客户|雇员"
Dim tr As WinForm.TreeView
Dim nd,nd1,nd2,nd3 As WinForm.TreeNode
tr = e.Form.Controls("TreeView1") 'Forms("窗口1").Controls("TreeView1")
tr.Nodes.Clear
for i as integer = 0 to dl.split("|").length-1
nd = Tr.Nodes.Add("Root & i","按" & "" & dl.split("|")(i) & "")
Dim pcas As List(Of String)
pcas = DataTables("订单").GetUniqueValues("", "" & dl.split("|")(i) & "")
For ii As integer = 0 to pcas.count-1
nd1 = nd.Nodes.Add("Sub & ii+1","" & pcas(ii) & "")
if i+1<=dl.split("|").length-1
dim f as string = "[" & dl.split("|")(i) & "] = '" & nd1.text & "' "
Dim cas As List(Of String) = DataTables("订单").GetUniqueValues( f ,"" & dl.split("|")(i+1) & "")
for iii as integer = 0 to cas.count-1
nd2 = nd1.Nodes.Add("Sub & iii+1","" & cas(iii) & "")
if i+2=dl.split("|").length-1
dim f1 as string = "[" & dl.split("|")(i+1) & "] = '" & nd2.text & "'"
Dim ca As List(Of String) = DataTables("订单").GetUniqueValues(f & "and " & f1 ,"" & dl.split("|")(i+2) & "")
for iiii as integer = 0 to ca.count-1
nd3 = nd2.Nodes.Add("Sub & iiii+1","" & ca(iiii) & "")
next
end if
if i+2-dl.split("|").length+1 = 1
dim f1 as string = "[" & dl.split("|")(i+1) & "] = '" & nd2.text & "'"
Dim ca As List(Of String) = DataTables("订单").GetUniqueValues(f & "and " & f1 ,"" & dl.split("|")(0) & "")
for iiii as integer = 0 to ca.count-1
nd3 = nd2.Nodes.Add("Sub & iiii+1","" & ca(iiii) & "")
next
end if
next
else
dim f as string = "[" & dl.split("|")(i) & "] = '" & nd1.text & "' "
Dim cas As List(Of String) = DataTables("订单").GetUniqueValues(f ,"" & dl.split("|")(0) & "")
for iii as integer = 0 to cas.count-1
nd2 = nd1.Nodes.Add("Sub & iii+1","" & cas(iii) & "")
dim f1 as string = "[" & dl.split("|")(0) & "] = '" & nd2.text & "'"
if i+2-dl.split("|").length-1 = 0
Dim ca As List(Of String) = DataTables("订单").GetUniqueValues(f & "and " & f1 ,"" & dl.split("|")(1) & "")
for iiii as integer = 0 to ca.count-1
nd3 = nd2.Nodes.Add("Sub & iiii+1","" & ca(iiii) & "")
next
end if
next
end if
Next
next
总觉得很繁琐,应该可以简化的,可是俺功底不足, 看看其他前辈和狐友的了。
俺把代码贴出来吧:
总觉得很繁琐,应该可以简化的,可是俺功底不足, 看看其他前辈和狐友的了。
厉害!