How to get DataGridViewRow from CellFormatting event?
Posted
by tomaszs
on Stack Overflow
See other posts from Stack Overflow
or by tomaszs
Published on 2009-10-15T12:58:30Z
Indexed on
2010/05/27
5:21 UTC
Read the original article
Hit count: 320
I have a DataGridView and handle event CellFormatting. It has a parameter called:
DataGridViewCellFormattingEventArgs e
With
e.RowIndex in it.
When i do:
DataGridView.Rows[e.RowIndex]
I get proper row from collection.
But when I click at a header of a column to sort it by other column than default one and user DataGridView.Rows[e.RowIndex] I get unproper row.
It is because Rows collection do not reflect order of rows in DataGridView.
So how to get propert DataGridViewRow from RowIndex in DataGridView?
© Stack Overflow or respective owner