-- 作者:狐狸爸爸
-- 发布时间:2014/1/9 16:41:00
--
某行代码换个位置,原因自己琢磨一下:
Dim tr As WinForm.TreeView = e.Form.Controls("TreeView1") Dim Cmb1 As String = e.Form.Controls("ComboBox1").Value Dim dt As DataTable = DataTables("MPS_计划明细") \'生成目录树 Select Case Cmb1 Case "订单编号" tr.Nodes.Clear \'清空当前目录树 tr.buildtree("MPS_计划明细","订单编号|顶层编码") tr.Nodes.Insert("显示所有",0) \'最顶端显示 tr.StopRedraw() For Each nd As WinForm.treeNode In tr.AllNodes If nd.Level = 1 Then nd.text = nd.text & "|" & nd.DataRow("品名") Functions.Execute("AddChildren_MPS",nd,dt) End If Next tr.ResumeRedraw() Case "客户" tr.Nodes.Clear \'清空当前目录树 tr.buildtree("MPS_计划明细","客户|订单编号|顶层编码") tr.Nodes.Insert("显示所有",0) \'最顶端显示 tr.StopRedraw() For Each nd As WinForm.treeNode In tr.AllNodes If nd.Level = 2 Then nd.text = nd.text & "|" & nd.DataRow("品名") Functions.Execute("AddChildren_MPS",nd,dt) End If Next tr.ResumeRedraw() Case "产品编码" tr.Nodes.Clear \'清空当前目录树 tr.buildtree("MPS_计划明细","顶层编码") tr.StopRedraw() For Each nd As WinForm.treeNode In tr.AllNodes If nd.Level = 0 Then nd.text = nd.text & "|" & nd.DataRow("品名") Functions.Execute("AddChildren_MPS",nd,dt) End If Next tr.Nodes.Insert("显示所有",0) \'最顶端显示 tr.ResumeRedraw() End Select
|