Using C# in VS 2005 SP1 with .Net Framework 2 SP1, I have the following
code:

private void MyDataGridView_RowPostPaint(object sender,
DataGridViewRowPostPaintEventArgs e)
{
DataGridViewRow gridRow = MyDataGridView.Rows[e.RowIndex];
// ....

and it crashes because e.RowIndex is larger than the number of rows in
MyDataGridView.

It's pretty obvious how to code a workaround for this bug, but it seems ...
hmm, maybe no dumber than usual.

RE: DataGridView.RowPostPaint event, e.RowIndex is out of range by RobFord

RobFord
Wed Apr 09 12:23:01 CDT 2008

I've seen a similar issue caused by a bug that was introduced in .NET 2.0 SP1
in the DataView. Are you bound to a DataView? Can you test the code on a
machine without 2.0SP1 installed on it?

Rob
--
Must control fist of death


"Norman Diamond" wrote:

> Using C# in VS 2005 SP1 with .Net Framework 2 SP1, I have the following
> code:
>
> private void MyDataGridView_RowPostPaint(object sender,
> DataGridViewRowPostPaintEventArgs e)
> {
> DataGridViewRow gridRow = MyDataGridView.Rows[e.RowIndex];
> // ....
>
> and it crashes because e.RowIndex is larger than the number of rows in
> MyDataGridView.
>
> It's pretty obvious how to code a workaround for this bug, but it seems ...
> hmm, maybe no dumber than usual.
>
>