如何实现目录树只显示,第2部分产品,材料不显示?
Dim Filter As String
Dim dr As DataRow = e.Node.DataRow '获取生成此节点的行
If e.Node.Text <> "显示所有行" Then
Select Case e.Node.Level
Case 0
Filter = "[产品类别] = '" & dr("产品类别") & "'"
Case 1
Filter = "[产品类别] = '" & dr("产品类别") & "' And [主类] = '" & dr("主类") & "'"
Case 2
Filter = "[产品类别] = '" & dr("产品类别") & "' And [主类] = '" & dr("主类") & "' And [次类] = '" & dr("次类") & "'"
End Select
End If
Tables("产品导入_产品材料明细").Filter = Filter
Dim trv As WinForm.TreeView = e.Form.Controls("TreeView1")
trv.BuildTree("产品材料明细", "产品类别|主类|次类")
trv.Nodes.Insert("显示所有行",0)