I have a column in datagrid that displays all the prices. I want to sum up all the values from all the rows of that column and display it as a label. How can I sum up the data??
Dim s As Double = 0 'sum result Dim colNum As Integer 'column number (zero-based) 'dgvData is your DataGridView For Each r As DataGridViewRow In dgvData.Rows colNum = 0 'first column s += Val(r.Cells.Item(colNum).Value) Next Sharbell K. Mouess
Comments
Dim colNum As Integer 'column number (zero-based)
'dgvData is your DataGridView
For Each r As DataGridViewRow In dgvData.Rows
colNum = 0 'first column
s += Val(r.Cells.Item(colNum).Value)
Next
Sharbell K. Mouess