这样写子字节去除勾加载,打勾不加载,跟我要的效果相反,我要打勾加载,去除勾不加载,另点一级子节没反应,其他子节没筛选。
Dim trv As WinForm.TreeView = e.Sender
Dim flt,flt1,flt2,flt3 As String
Dim nd As WinForm.TreeNode
If trv.Nodes(0).Name = e.Node.Name
If e.Node.Checked
For Each nd In trv.AllNodes
nd.Checked = False
Next
e.Node.Checked = True
Else
flt = "1=2"
End If
Else
Dim nms As String() = {"团体赛或个人赛","棋赛名称","分组","第几轮比赛","姓名"} '指定生成目录树的各列
Dim qts As String() = {"'","'","'","'","'"} '指定将各列的值括起来的符号,这里都是字符型,所以都是单引号
Dim nms1 As String() = {"团体赛或个人赛","棋赛名称","分组","所属团体","第几轮比赛","姓名"} '指定生成目录树的各列
Dim qts1 As String() = {"'","'","'","'","'","'"} '指定将各列的值括起来的符号,这里都是字符型,所以都是单引号
Dim s() As String = {"个人赛","团体赛","擂台赛"}
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 val As String = ""
Dim rts() As String = nd.FullPath.Split("\")
If nd.FullPath Like s(0) & "\*"
For i As Integer = 1 To rts.length - 1
If val > "" Then
val = val & " And "
End If
val = val & nms(i-1) & " = " & qts(i-1) & rts(i) & qts(i-1)
Next
If flt > "" Then
flt = flt & " or (" & val & ")"
Else
flt = val
End If
ElseIf nd.FullPath Like s(1) & "\*"
For i As Integer = 1 To rts.length - 1
If val > "" Then
val = val & " And "
End If
val = val & nms1(i-1) & " = " & qts1(i-1) & rts(i) & qts1(i-1)
Next
If flt1 > "" Then
flt1 = flt1 & " or (" & val & ")"
Else
flt1 = val
End If
ElseIf nd.FullPath Like s(2) & "\*"
For i As Integer = 1 To rts.length - 1
If val > "" Then
val = val & " And "
End If
val = val & nms1(i-1) & " = " & qts1(i-1) & rts(i) & qts1(i-1)
Next
If flt2 > "" Then
flt2 = flt2 & " or (" & val & ")"
Else
flt2 = val
End If
End If
End If
Next
If flt1 > "" Then
flt1 = s(0) & "' And " & flt1 & "'"
End If
If flt2 > "" Then
flt2 = s(1) & "' And " & flt2 & "'"
End If
If flt3 > "" Then
flt3 = s(2) & "' And " & flt3 & "'"
End If
If flt1 > "" Then
flt = "(" & flt1 & ")"
End If
If flt2 > "" Then
If flt > "" Then
flt = flt & " Or "
End If
flt = flt & "(" & flt2 & ")"
End If
If flt3 > "" Then
If flt > "" Then
flt = flt & " Or "
End If
flt = flt & "(" & flt3 & ")"
End If
End If
With DataTables("比赛积分")
.LoadFilter = flt '设置加载条件
.LoadPage = 0 '加载第一页
.LoadTop = 20 '每页5行
.loadover = "_Identify"
.LoadReverse = True
.Load()
e.Form.Controls("TextBox1").Value = 1 & "/" & .TotalPages
End With
[此贴子已经被作者于2021/12/28 11:12:27编辑过]