Sum values in datatable column til 0 is found (subtotal)

69 views Asked by At

I have a datatable with the following values:

Name1 | 1

Name1 | 1

Name1 | 1

Name1 | 0

Name1 | 1

Name1 | 0

Name2 | 1

Name2 | 0

and I want to end up with the following values in another datatable, basically subtotaling the column until a zero is found

Name1 | 3

Name1 | 1

Name2 | 1

I can put the original data into an array, a list, it doesn't matter, I just can't figure out how to do this!

I haven't tried anything that came close, so I don't have any code to add.

Thank you!

1

There are 1 answers

0
CatEight On

I created a couple of loops that manipulated the data using two columns in the datagridview. This isn't an actual answer, it's more of a hack, but I don't plan on checking this post any more and didn't want to leave it hanging