以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  Current  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=143751)

--  作者:huizhong
--  发布时间:2019/12/3 15:11:00
--  Current
老师请教一下:
我在窗口的Table(附表)的CurrentChanged事件中加入以下代码,保证主表数据同步
If Tables("公司业绩查询窗口_Table2").rows.count > 0 Then
    Dim dr As DataRow = e.Table.Current.DataRow
    Dim wz As Integer = Tables("项目基础表").FindRow(dr)
    If wz >=0 Then
        Tables("项目基础表").Position = wz
    End If
End If
同时,在该窗口的打开窗口事件中有对该表数据的筛选和汇总代码,运行时,打开窗口时系统报错:“未将对象引用设置到对象的实例。”应该是在打开窗口时,附表进行数据整理与CurrentChanged事件代码冲突导致的,请老师给指导下,该如何规避

--  作者:有点蓝
--  发布时间:2019/12/3 15:26:00
--  
代码改为

If e.Table.Current isnot nothing Then
    Dim dr As DataRow = e.Table.Current.DataRow
    Dim wz As Integer = Tables("项目基础表").FindRow(dr)
    If wz >=0 Then
        Tables("项目基础表").Position = wz
    End If
End If

--  作者:huizhong
--  发布时间:2019/12/3 16:50:00
--  
谢谢老师,问题解决了