以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  [讨论]错误事件  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=96903)

--  作者:苏州老街
--  发布时间:2017/3/2 9:25:00
--  [讨论]错误事件
老师,菜单事件我没有设置过为什么有这样的错误提示,该事件位置在哪里找到?。谢谢

.NET Framework 版本:2.0.50727.3655
Foxtable 版本:2016.7.29.1
错误所在事件:菜单,AfterSelRangeChange
详细错误信息:
Object reference not set to an instance of an object.


--  作者:有点蓝
--  发布时间:2017/3/2 9:37:00
--  
事件代码贴出来
--  作者:有点色
--  发布时间:2017/3/2 10:12:00
--  

导入系统菜单,修改一下菜单的 AfterSelRangeChange事件


Dim t As Table
RibbonMenu.StatusBar.Message3 = ""
Vars("SysUpdateAggregate") = False
If e.Table IsNot CurrentTable OrElse CurrentTable Is Nothing Then
    Return
Else
    t = CurrentTable
End If
If t.TopRow = t.BottomRow AndAlso t.LeftCol = t.RightCol Then
    Return
End If
For c As Integer = t.LeftCol To t.RightCol
    If C > 0 Then
        If t.Cols(c).IsNumeric = False Then
            Return
        End If
    End If
Next
Vars("SysUpdateAggregate") =  True

 

http://www.foxtable.com/webhelp/scr/1079.htm

 


--  作者:苏州老街
--  发布时间:2017/3/2 10:24:00
--  
老师,上面好了,下面错误提示找不出原因。


.NET Framework 版本:2.0.50727.3655
Foxtable 版本:2016.7.29.1
错误所在事件:表,费用明细, DataColChanged
详细错误信息:
Exception has been thrown by the target of an invocation.
Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index


Select Case  e.DataCol.Name
    Case "姓名","项目","规格"
        Dim n1 As Integer
        Dim Lms,py,jps As  String
        Dim jps1 As New List(Of String)
        
        Lms ="姓名|项目|规格"
        For Each py  In Lms.split("|")
            If  py =e.DataCol.Name Then
                Exit For
            End If
            n1+=1
        Next
        If e.DataRow.Isnull(e.DataCol.Name) Then
            py  ="@|#|$".split("|")(n1)
        Else
            py = GetPY(e.DataRow(e.DataCol.Name),True)
        End If
        
        jps1.AddRange(e.DataRow("简拼").split("|"))
        jps1.Insert(n1,py)
        jps1.RemoveAt(n1+1)
        
        For Each py  In jps1
            jps+=py & "|"
        Next
        e.DataRow("简拼") = jps.trim("|")
End Select
[此贴子已经被作者于2017/3/2 10:24:59编辑过]

--  作者:有点色
--  发布时间:2017/3/2 10:38:00
--  

 例子上传来测试。

 

Select Case  e.DataCol.Name
    Case "姓名","项目","规格"
        Dim n1 As Integer
        Dim Lms,py,jps As  String
        Dim jps1 As New List(Of String)
       
        Lms ="姓名|项目|规格"
        For Each py  In Lms.split("|")
            If  py =e.DataCol.Name Then
                Exit For
            End If
            n1+=1
        Next
        If e.DataRow.Isnull(e.DataCol.Name) Then
            py  ="@|#|$".split("|")(n1)
        Else
            py = GetPY(e.DataRow(e.DataCol.Name),True)
        End If
        If e.DataRow.isnull("简拼") = False Then
            jps1.AddRange(e.DataRow("简拼").split("|"))
        Else
            jps1.AddRange("@|#|$".split("|"))
        End If
        jps1.Insert(n1,py)
        jps1.RemoveAt(n1+1)
       
       
        For Each py  In jps1
            jps+=py & "|"
        Next
        e.DataRow("简拼") = jps.trim("|")
       
End Select


--  作者:苏州老街
--  发布时间:2017/3/2 12:04:00
--  
老师,新增行是可以的,原来的数据重置列就不行。
--  作者:有点色
--  发布时间:2017/3/2 12:12:00
--  
 实例上传上来测试。