'How to sum all same name item at the datagridview in vb?
Assume that I have a form, there is a dategridview1. I have several items already added in the dgv (ex.notebook, pen, paper, eraser, etc.)
Now, I want to sum all the quantity of let say notebook. Label1 will display the sum of all notebooks added in the dgv.
Thanks
Solution 1:[1]
my commands may be off but i'd imagine it would go something like this,
dim sum as int/double
for each row as dgv.row in datagridview1.rows
if row.column(0).ToString = samename then
sum += cint(row.column(2))
end if
next
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | drpepper1324 |
