2014-12-03 102 views

回答

0

这个总结列

mylabel.text = Convert.ToDouble(CType(DGV.DataSource, DataTable).Compute("SUM(MyColumn)", "")) 
0

您可以通过使用换结构得到于行“i”和列“X”接入小区的每一个值。此示例显示如何获取列“x”中每个值的总和并将其设置为标签。

Dim sum As Double = 0 
With Me.myDGV 
    For i = 0 To .RowCount - 1 
     Dim value As Double = .Rows(i).Cells(x).Value 
     'compute something with the value, for example add to a sum 
     sum = sum + value 
    Next 
End With 
Me.myLabel.text = sum.ToString 
相关问题