Why is my bound DataGridView throwing an “Operation not valid because it results in a reentrant call to the SetCurrentCellAddressCore function” error?

The exception is raised by the DataGridView in order to prevent an infinite loop from occurring. The cause of this is usually one of the following:

  • Changing the active cell while an operation is being performed on the currently-active cell
  • Beginning, ending or cancelling edit mode while a cell edit is already in-progress
  • Any other operation that results in the active cell being changed while the DataGridView is still using it

Have a look at your handler for the CellValueChanged event and make sure you are not doing any of the above within the handler.

Leave a Comment