如果网格底部的数据> 0,则需要行计数 [英] need row count if having data>0 at the footer of the grid
问题描述
我将数据绑定到网格
但是现在如果只包含数据,我需要几列具有行数
例如A B c
10 0 0
0 10 0
0 0 10
30 0 0
-----------------------------------------------
2 1 1
在网格中显示数据
只需要计数
对于具有数据的行
是用grid.rowdatabound ??? how
i got data binded to grid
but now i need few columns to have rowcount if having data only
eg A B c
10 0 0
0 10 0
0 0 10
30 0 0
-----------------------------------------------
2 1 1
have data showing in grid
only count is required
for rows having data
is it to be written in grid.rowdatabound???how
推荐答案
如何回合:
How ''bout:
Dim Acount, Bcount, Ccount as UShort
For Each row As DataGridViewRow In DataGridView1.Rows
if row.Cells(0).Value > 0 then Acount += 1
if row.Cells(1).Value > 0 then Bcount += 1
if row.Cells(2).Value > 0 then Ccount += 1
Next
这篇关于如果网格底部的数据> 0,则需要行计数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!