以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- [讨论]怎样用递归生成目录树 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=82379) |
-- 作者:xongyijd -- 发布时间:2016/3/16 19:06:00 -- [讨论]怎样用递归生成目录树 我现在rom表用两个主表和明细表构成,现在想用递归生成目录树展示产品目录总是不成功,直接崩溃退出系统,不知道代码怎样改?
函数代码:Dim nd As WinForm.TreeNode = args(0)
Dim dt As DataTable = args(1)
Dim drs As List(of DataRow)
drs= dt.Select("[父件编码] = \'" & nd.name & "\'")
For Each dr As DataRow In drs
Dim cd As Winform.TreeNode = nd.Nodes.Add(dr("子件编码"),dr("子件编码") & " " & dr("子件名称"))
Functions.Execute("产品结构目录树函数",cd,dt)
Next
生成代码:\'Dim tr As WinForm.TreeView = e.Form.Controls("TreeView1")
\'Dim nd As WinForm.TreeNode
\'Dim dt As DataTable = DataTables("产品结构")
\'Dim dt1 As DataTable = DataTables("结构主表")
\'tr.StopRedraw()
\'tr.Nodes.Clear
\'tr.Nodes.Add("全部显示")
\'For Each da As DataRow In dt1.DataRows
\'If da("是否最终产品") = True Then
\'nd = tr.Nodes.Add(da("物料编码"),da("物料编码") & " " & da("物料名称") & " " & da("物料规格"))
\'Functions.Execute("产品结构目录树函数",nd,dt)
\'End If
\'
\'Next
\'tr.ResumeRedraw()
|
-- 作者:大红袍 -- 发布时间:2016/3/16 19:36:00 -- 代码没什么问题,上传具体例子测试。 |