此主题相关图片如下:filtertree.png
老师,
您好!
如图, 我想在筛选树上加入一个"刷新"节点用于刷新筛选树
代码, 但点击时报错"未将对象引用设置到对象实例"
麻烦帮忙看看问题出在哪?
窗口afterload:
Dim tv1 As WinForm.TreeView
tv1 =e.Form.Controls("TreeView1")
tv1.BuildTree("预算汇总","年份|月份|部门")
tv1.Nodes.Insert("刷新",0)
tv1.Nodes.Insert("显示所有行",1)
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
If e.Node.Text = "刷新" Then
Dim tv1 As WinForm.TreeView
tv1 =e.Form.Controls("TreeView1")
tv1.BuildTree("预算汇总","年份|月份|部门")
tv1.Nodes.Insert("显示所有行",0)
tv1.Nodes.Insert("刷新",0)
End If