以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  筛选后台数据时的错误提示  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=186849)

--  作者:HANZHIGANG
--  发布时间:2023/6/2 21:03:00
--  筛选后台数据时的错误提示
Dim frm As winform.Form = e.Form 
Dim Tbl As Table = frm.Controls("Table1").Table
Dim dtb As New DataTableBuilder("px")
dtb.AddDef("_Identify", GetType(Integer))
dtb.AddDef("_Sortkey", GetType(Double))
dtb.AddDef("glType", GetType(String), 100, "", "逻辑")
dtb.AddDef("glCol", GetType(String), 100, "", "过滤字段")
dtb.AddDef("glMath", GetType(String), 100, "", "操作符")
dtb.AddDef("glValue", GetType(String), 250, "", "值")
Tbl.DataSource = dtb.BuildDataSource

MessageBox.Show("1")

Tbl.DataTable.AllowResizeRow = False
Tbl.DataTable.AllowEdit = True
Tbl.DataTable.AllowDragColumn = False
Tbl.DataTable.AllowFreezeColumn = False
Tbl.DataTable.AllowResizeColumn = False
Tbl.DataTable.AllowClipBoard = False
\'Tbl.DataTable.SysStyles("EmptyArea").BackColor = Color.fromargb(-1250856)
\'Tbl.DataTable.SysStyles("Normal").BackColor = Color.fromargb(-1250856)
Tbl.DataTable.SysStyles("Alternate").BackColor = Color.fromargb( - 983041)
Tbl.ExtendLastCol = True
Tbl.UseVisualStyle = False
Tbl.grid.borderstyle = 2

MessageBox.Show("2")

Dim dmp As New datamap
dmp.Add("1", "并且")
dmp.Add("2", "或者")
Tbl.cols("glType").DataMap = dmp
Tbl.cols("glType").DataCol.DefaultValue = "1"

MessageBox.Show("3")

dmp = New datamap
For Each c As Col In CurTbl.cols
    If c.Visible Then
        dmp.Add(c.name, c.Caption)
    End If
Next

MessageBox.Show("4")

Tbl.cols("glCol").DataMap = dmp
Tbl.Cols("glType").Width = 60
Tbl.Cols("glCol").Width = 160
Tbl.Cols("glMath").Width = 80

MessageBox .Show("5")

dmp = New datamap
dmp.Add("1", "等于")
dmp.Add("2", "大于")
dmp.Add("3", "小于")
dmp.Add("4", "不小于")
dmp.Add("5", "不大于")
dmp.Add("6", "不等于")
dmp.Add("7", "包含")
Tbl.cols("glMath").DataMap = dmp
Tbl.cols("glMath").DataCol.DefaultValue = "1"


Tbl.Sort = ""

Tbl.Cols("glType").TextAlign = TextAlignEnum.Center
Tbl.Cols("glMath").TextAlign = TextAlignEnum.Center

Tbl.SetHeaderRowHeight(28)
Tbl.DefaultRowHeight = 28

此代码放在高级筛选窗口的AFTERLAOD事件中,第4段时出现错误提示:.NET Framework 版本:4.0.30319.42000
Foxtable 版本:2022.8.18.1
错误所在事件:窗口,高级查询,AfterLoad
详细错误信息:
未将对象引用设置到对象的实例。

请老师帮看一下,问题出在了哪里

--  作者:有点蓝
--  发布时间:2023/6/3 8:51:00
--  
试试

dmp = New datamap
For Each c As Col In CurTbl.cols
    If c.Visible andalso c.Caption > "" Then
        dmp.Add(c.name, c.Caption)
    End If
Next