Hi ,
how to add numbers in specific count of rows in Datagridview like in thisClick Here picture.

I already run this code to sum all collumn in my Datagridview. But I need to sum the 1+2+4 in collumn TEST1 without erasing the other data.

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click

        'TOTAL sum in Datagridview
        If Table1DataGridView.RowCount > 1 Then
            Dim iOLDd As Decimal = 0

            For index As Integer = 0 To Table1DataGridView.RowCount - 1
                iOLDd += Convert.ToDecimal(Table1DataGridView.Rows(index).Cells(1).Value)
            Next
            TextBox1.Text = Format(iOLDd, "0.00")
        End If
    End Sub

Thanks !

Can you not just hard code this:

Dim x As Decimal = 0

x += Convert.ToDecimal(Table1DataGridView.Rows(0).Cells(1).Value)
x += Convert.ToDecimal(Table1DataGridView.Rows(1).Cells(1).Value)
x += Convert.ToDecimal(Table1DataGridView.Rows(3).Cells(1).Value)

Where Cells(1) is the appropriate column?

This question has already been answered. Start a new discussion instead.