Reputation: 79
It's my export code from datagridview to excel file:
for (int s = 0; s < dgw.Rows.Count - 1; s++)
{
for (int s2 = 0; s2 < dgw.Columns.Count - 1; s2++)
{
ea.Cells[s + 2, s2 + 1] = dgw.Rows[s].Cells[s2].Value.ToString();
}
}
Thank you for answers.
Upvotes: 1
Views: 50
Reputation: 1145
The error is here: for (int s2 = 0; s2 < dgw.Columns.Count - 1; s2++)
Remove -1
or change <
to <=
Upvotes: 1