以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  [求助]提示表达式列为只读  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=113369)

--  作者:天一生水
--  发布时间:2018/1/14 22:49:00
--  [求助]提示表达式列为只读

窗口的AfterLoad事件代码,[立案年份]、[立案月份]都是表达式列,我在打开窗口时将这两列作为目录树节点,没出现过错误,今天提示[立案年份]为只读,目录树无法打开,是何原因?

代码如下:

e.Form.Controls("CheckedComboBox筛选树").text = "立案年份|立案月份|立案日期|案号"

Dim s As String = e.Form.Controls("CheckedComboBox筛选树").text
If s = "" OrElse s = "选择筛选列" Then
    Return
End If
\'Dim t As Table = CurrentTable
Dim t As Table = Tables("数据表")
Dim r As Row
Dim c As String
Dim tr As WinForm.TreeView = e.Form.Controls("TreeView筛选树")
Dim Colstr() As String
Colstr = s.Split("|")
For Each r In t.Rows
    For Each c In Colstr
        If r.IsNull(c) Then
            If t.Cols(c).DataCol.IsDate Then
                r(c) = #01/01/0001#
            ElseIf t.Cols(c).DataCol.IsNumeric Then
                r(c) = 0
            ElseIf t.Cols(c).DataCol.IsBoolean
                r(c) = False
            Else
                r(c) = "空"
            End If
        End If
    Next
Next
tr.StopRedraw()
tr.Nodes.Clear
tr.BuildTree(t.DataTable.Name,s)
tr.ResumeRedraw()
If tr.AllNodes.Count > 0 Then
    tr.Nodes.Insert("显示所有行",0)
End If
tr.Select()
If t.DataTable.Type = 5 Then
    For Each r In t.Rows
        For Each c In Colstr
            If t.Cols(c).DataCol.IsDate Then
                If r(c) = #01/01/0001#
                    r(c) = Nothing
                End If
            ElseIf t.Cols(c).DataCol.IsNumeric Then
                If r(c) = 0 Then
                    r(c) = Nothing
                End If
            ElseIf t.Cols(c).DataCol.IsBoolean Then
                If r(c) = False Then
                    r(c) = Nothing
                End If
            Else
                If r(c) = "空" Then
                    r(c) = Nothing
                End If
            End If
        Next
    Next
Else
    t.DataTable.RejectChanges
End If


--  作者:有点甜
--  发布时间:2018/1/14 22:58:00
--  
为什么要用表达式列?表达式列是不能直接赋值的。请改为数据列。