Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim data = firstDgv.Rows.Cast(Of DataGridViewRow)() _
.GroupBy(Function(r) New With {Key .A = r.Cells(0).Value, Key .B = r.Cells(1).Value}) _
.Select(Function(grp) New With
{
grp.Key.A,
grp.Key.B,
.C = grp.Sum(Function(x) CInt(x.Cells(2).Value))
}) _
.ToList()
For Each dgr In data
secondDgr.Rows.Add(New Object() {dgr.A, dgr.B, dgr.C})
Next
End Sub