Hello,
I have a datagridview with multiples rows from database.
The content of my datagrid can be printed, on every page can be printed only 45 record + 1 record for the SUM of the last tow columns.
How can i calculate the SUM for every 45 records? I don't know haw many record are in the database, can be 25 or 500.
OK,
I have the following table.
No. Column1 Column2 Column3 Column4
1 some data some data 20 30
2 some data some data 20 30
3 some data some data 20 30
................................................
45 some data some data 20 30
46 some data some data 20 30
................................................
89 some data some data 20 30
90 some data some data 20 30
................................................
To calculate the SUM of column3 for all rows i use:
for (int i = 0; i < datagridview.Rows.Count; ++i)
{
suminchise += Convert.ToDouble(datagridview.Rows[i].Cells[3].Value);
}
But, in my printing are displayed only 45 record on every page, and i need to calculate the sum of the column3 only for the first 45 row, and for page to for record 46 to 90, next 91 to 135, etc...