窗口AFTERLOAD事件:
e.Form.Controls("TreeView3").BuildTree("出库",
"销售人员|客户单位|型号")
e.Form.Controls("TreeView3").BuildTree("出库",
"销售人员|客户单位|型号")
筛选树代码:
Dim mls
As String()
= {"供应商","产品名称","型号"} '指定生成目录树的各列
Dim kh As String() =
{"'","'","'"} '指定将各列的值括起来的符号,这里都是字符型,所以都是单引号
Dim cs As WinForm.TreeView =
e.Sender
Dim sx As String
Dim jd As WinForm.TreeNode
For Each jd In e.node.allNodes '清除子节点的选中标记
jd.Checked = False
Next
jd = e.Node.ParentNode
Do While jd IsNot Nothing '清除父节点的选中标记
jd.Checked = False
jd = jd.ParentNode
Loop
For Each jd In cs.AllNodes
If jd.Checked Then
Dim xjd() As String =
jd.FullPath.Split("\")
Dim val As String = ""
For i As Integer = 0 To xjd.length - 1
If val > "" Then
val = val
& " And
"
End If
val = val & mls(i) & " = " &
kh(i) & xjd(i) & kh(i)
Next
If sx > "" Then
sx = sx & " Or ("
& val & ")"
Else
sx = val
End If
End If
Next
Tables("出入库").Filter = sx
此代码通用性很强,对照你的系统修改表名、列名即可。
注;FOXTABLE帮助中也有此段代码,我照搬而已。