Rss & SiteMap

Foxtable(狐表) http://www.foxtable.com

新一代数据库软件,完美融合Access、Foxpro、Excel、vb.net之优势,人人都能掌握的快速软件开发工具!
共2 条记录, 每页显示 10 条, 页签: [1]
[浏览完整版]

标题:[求助]表格数据合计

1楼
xubing051018 发表于:2023/11/8 11:38:00
参考帮助手册写的代码

AfterSelRangeChange 事件里


Dim it As Winform.StripItem = Forms("窗口").Strips("状态栏").Items("Total")
    Dim t As Table = e.Table
    it.Text = ""
    If t.Cols(t.ColSel).IsNumeric Then '如果当前列是数值列
        it.Text = "合计:  " & t.Aggregate(AggregateEnum.Sum, t.TopRow, t.ColSel, t.BottomRow, t.ColSel)
    End If

正常窗口表里执行正常
但是如果窗口表是做了折叠显示的时候,鼠标选择父级单元格的时候,合计数据会把下级的数据也统计进来。
请教,如何调整代码,只把鼠标选到的单元格数据合计?
2楼
有点蓝 发表于:2023/11/8 11:42:00
Dim it As Winform.StripItem = Forms("窗口").Strips("状态栏").Items("Total")
    Dim t As Table = e.Table
    it.Text = ""
    If t.Cols(t.ColSel).IsNumeric Then '如果当前列是数值列
 dim sum as double
for i as integer = t.TopRow to t.BottomRow
if t.rows(i).visible then
sum  += t.rows(i)(t.ColSel)
end if
        it.Text = "合计:  " & sum  
    End If
共2 条记录, 每页显示 10 条, 页签: [1]

Copyright © 2000 - 2018 foxtable.com Tel: 4000-810-820 粤ICP备11091905号

Powered By Dvbbs Version 8.3.0
Processed in .01953 s, 2 queries.