以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.net/bbs/index.asp)
--  专家坐堂  (http://foxtable.net/bbs/list.asp?boardid=2)
----  双击节点后报错  (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=71580)

--  作者:lingyun00800
--  发布时间:2015/7/14 11:32:00
--  双击节点后报错
窗口事项内
e.Form.Controls("TreeView1").BuildTree("A", "报岗类型|报岗站")
双击节点后执行
Dim Filter As String
If e.node.Text = "加载所有数据" Then
    Filter = ""
Else
    Dim dr As DataRow = e.Node.DataRow \'获取生成此节点的DataRow
    Select Case e.Node.Level
        Case 0
            Filter ="[报岗类型] = \'" & dr("报岗类型") & "\'"
        Case 1
            Filter ="[报岗类型] = \'" & dr("报岗类型") & "\' And [报岗站] = \'" & dr("报岗站") & "\'"
    End Select
End If
DataTables("A").LoadFilter = Filter
DataTables("A").Load()

表A 是个查询表

在双击节点时提示
此行已从表中移除并且没有任何数据。BeginEdit() 将允许在此行中创建新数据


--  作者:大红袍
--  发布时间:2015/7/14 11:34:00
--  

如果不用DataRow属性,则需要直接拆分节点的FullPath,代码为:

Dim Filter As String = ""
Dim Value() As String
Value = e.Node.FullPath.Split("\\")
If e.Node.Text <> "显示所有行" Then
    Select Case e.Node.Level
        Case 0
            Filter = "[产品] = \'" & Value(0) & "\'"
        Case 1
            Filter = "[产品] = \'" & Value(0) & "\' And [客户] = \'" & Value(1) & "\'"
        Case 2
            Filter = "[产品] = \'" & Value(0) & "\' And [客户] = \'" & Value(1) & "\' And [雇员] = \'" & Value(2) & "\'"
    End Select
End If
Tables("订单").Filter = Filter

 

http://www.foxtable.com/help/topics/2690.htm