Dim tr As WinForm.TreeView = e.Form.Controls("TreeView1") tr.CreateTree("表A","绝对路径") For Each nd As WinForm.TreeNode In tr.AllNodes Dim lj As String = nd.DataRow("绝对路径") Dim drs As List(Of DataRow) = DataTables("表A").Select("绝对路径 like '" & lj & "\%'") If drs.count = 0 Then nd.DataRow("单重重计") = nd.DataRow("隶属数量") * nd.DataRow("单重") Else Dim sum As Double = 0 For Each dr As DataRow In drs sum += dr("隶属数量") * dr("单重") Next nd.DataRow("单重重计") = sum End If nd.Text = nd.name & "(" & nd.DataRow("单重重计") & ")" Next tr.ExpandAll Dim sss As WinForm.TreeNode = tr.Nodes(0) .Nodes(0).nodes(0).nodes(0) MessageBox.Show(sss.Name)
|