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?

It is now works well..
Thanks DaveAmour :)

Youre welcome.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.