Foxtable(狐表)用户栏目专家坐堂 → [求助]子表计算


  共有1302人关注过本帖树形打印复制链接

主题:[求助]子表计算

帅哥哟,离线,有人找我吗?
有点色
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:13837 积分:69650 威望:0 精华:0 注册:2016/11/1 14:42:00
  发帖心情 Post By:2017/2/23 1:55:00 [显示全部帖子]

可以写到子表的datacolchanged事件

 

If e.DataCol.name = "日期" Then
    Dim pr As DataRow = e.DataRow.GetParentRow("父表")
    If pr IsNot Nothing Then
        Dim crs As List(of DataRow) = pr.GetChildRows("子表")
        Dim cnt As Integer
        Dim maxDate As Date
        For Each cr As DataRow In crs
            If cr.IsNull("日期") Then
                Exit For
            End If
            If maxDate < cr("日期") Then maxDate = cr("日期")
            cnt = cnt + 1
           
        Next
        If crs.Count = cnt Then
            pr("日期") = maxDate
        Else
            pr("日期") = Nothing
        End If
    End If
End If


 回到顶部