I have a DataGridView with a number of cells that have their ReadOnly property set to True.
When the user tabs through the cells using the tab key I want to move the focus onto the next cell if the ReadOnly property is true. My code is below:
private void filterGrid_CellEnter(object sender, DataGridViewCellEventArgs e)
{
if (!filterGrid.Rows[e.RowIndex].Cells[e.ColumnIndex].ReadOnly)
{
EditCell(sender, e);
}
else
{
//Move to the next cell
filterGrid.Rows[e.RowIndex].Cells[e.ColumnIndex + 1].Selected = true;
}
}
However, when I run the above code I receive the following error:
Operation is not valid because it results in a reentrant call to the SetCurrentCellAddressCore function.
I'm using C# 4.0
Thanks in advance.