2014-12-03 103 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 
相關問題