Thanks Frans,
I don't believe it's an issue with the DataGridView behaving improperly.
What I'm concerned about is in my "Save" code for the underlying collection for the DataGridView. I am attempting to save the collection, entity by entity - dirty ones only - not the entire collection.
I'm confused because the DataGridView seems to have created a new entity (empty) in the underlying collection, and my subsequent "Save" logic is trying to save it.
Under normal circumstances, this DataGridView works normally. When I fill all the fields in the object and then Save it without leaving the row, it works fine. This is an edge case that only occurs when the user fills all the fields in the DataGridView and at the last field, once they fill it in, they tab again (tab off the row onto a new one).
When you then click to save, the underlying collectin has both the newly added (and filled) row, as well as the fresh empty one.
Maybe this is just by default with the data binding logic of the DataGridView ... not sure. I would have assumed that the new object would not get persisted to the collection until either an explicit EndEdit/CommitEdit/etc. occurs by my code or implicitly by tabbing off the row.
My (ugly hack
) solution is to check the collection when I first enter my Save method and remove any objects that appear to be empty. I test several properties I know should have contents to determine whether to remove it.
Am I missing anything here?
Chris