以文本方式查看主题

-  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=149550)

--  作者:nbsugu_z
--  发布时间:2020/5/6 9:44:00
--  不是成员处理
Select Case e.DataCol.name
    Case "cpbm"
        If e.DataCol.Name = "cpbm" Then
            If e.DataRow.IsNull("cpbm")  Then
                e.DataRow("fxrq") = Nothing
                e.DataRow("qxrq") = Nothing
                \' e.DataRow("zxrq") = Nothing
            Else
                If e.DataRow.rowstate <> DataRowState.Unchanged Then
                    Dim ddr0 As DataRow
                    Dim max As Date
                    max = e.DataTable.Compute("Max(zxrq)")
                    ddr0 = DataTables("dk_lxb").Find("[cpbm] = \'" & e.DataRow("cpbm")  & "\'","zxrq desc")
                    If ddr0 IsNot Nothing
                        Dim zx1 As Date = ddr0("zxrq") \'止息日期
                        Dim zx2 As Date = zx1.addmonths(1)   \'第二次止息日期
                        Dim fx1 As Date = ddr0("fxrq")
                        Dim fx2 As Date = fx1.addmonths(1)
                        Dim qx1 As Date = ddr0("qxrq")
                        Dim qx2 As Date = qx1.addmonths(1)
                        e.DataRow("fxrq") = fx2
                        e.DataRow("qxrq") = qx2
                        
                        Dim d As Date = e.DataRow("qxrq")
                        If d.Day = 1 Then
                            e.DataRow("zxrq") = new Date(d.Year,d.Month,Date.DaysInMonth(d.Year,d.Month))
                        Else
                            e.DataRow("zxrq") = zx2
                        End If
                        
                    End If
                End If
            End If
        End If
End Select

以上代码我要写在chick按钮事件里,增加一行后执行。提示e.DataCol不是....成员。对这种情况如何处理呢?类似这种情况如何变通?

--  作者:有点蓝
--  发布时间:2020/5/6 9:50:00
--  
e.DataCol、e.DataRow这些是表事件才有的用法。如果放到按钮里,去掉列名的判断,把e.DataRow改为当前行如:tables("表A").current