帮助里面有代码:3、将目录树的AfterCheckNode事件代码设置为:
Dim nms As String() = {"产品","客户","雇员"}
'指定生成目录树的各列
Dim
qts
As
String()
=
{"'","'","'"}
'指定将各列的值括起来的符号,这里都是字符型,所以都是单引号
Dim
trv
As
WinForm.TreeView = e.Sender
Dim
flt
As
String
Dim
nd
As
WinForm.TreeNode
For
Each
nd
In
e.node.allNodes
'清除子节点的选中标记
nd.Checked = False
Next
nd = e.Node.ParentNode
Do
While
nd
IsNot
Nothing
'清除父节点的选中标记
nd.Checked = False
nd = nd.ParentNode
Loop
For
Each
nd
In
trv.AllNodes
If
nd.Checked Then
Dim
rts() As
String = nd.FullPath.Split("\")
Dim
val As String = ""
For
i As Integer = 0 To rts.length - 1
If val > ""
Then
val = val
&
" And
"
End
If
val = val
&
nms(i) &
" =
"
&
qts(i) &
rts(i) &
qts(i)
Next
If flt > ""
Then
flt = flt
&
" Or
("
&
val
&
")"
Else
flt = val
End If
End If
Next
Tables("订单").Filter = flt
现在想实现:窗口表中有一逻辑列名为“停用”,同时窗口中有一CheckBox控件(隐藏停用),用来控制是否显示停用的记录,当这个CheckBox勾选时(隐藏停用),点击TreeView节点复选框的时候,窗口表筛查出来的记录不包含停用的。反正,当CheckBox不勾选(即显示停用),窗口表筛查出来的记录包含停用的。不知道上面的通用代码如何修改?