Dim trv As WinForm.TreeView = e.Form.Controls("TreeView1")
DataTables("BOM").Save
Dim max As Integer = DataTables("BOM").Compute("max(_Identify)")
For Each nd As WinForm.TreeNode In trv.allNodes
Dim dr As DataRow = DataTables("BOM").Addnew()
dr("级码") = nd.fullname.replace("\",".")
dr("产品名称") = nd.Text
If nd.DataRow IsNot Nothing Then
dr("产品代码") = nd.DataRow("产品代码")
dr("规格型号") = nd.DataRow("规格型号")
End If
Next
DataTables("BOM").Save
DataTables("BOM").DeleteFor("_Identify <= " & max)
DataTables("BOM").Save()
trv.GenerateTree("BOM","级码","产品名称", ".")