G
Guest
I hope someone can shed some light on an error I've been experiencing for
sometime now, but can no longer continue to ignore :-(
I've created a custom entity class which implements IEditableObject. I have
then created a custom collection for this custom entity which naturally
inherits CollectionBase and implements IBindingList.
When I bind my custom collection to a DataGridView and started editing, it
works correctly only up to the point where you try to navigate off a newly
created (but empty) grid row - the second time, at which point it errors with
an ArgumentOutOfRange exception.
The stack trace indicates the error occurs in the GetCellDisplayRectangle
event and that the parameter name (of the invalid parameter) is rowIndex.
I'll try to explain a little better. If you add a row, by typing in some
values, the grid puts that row in "edit" mode and displays a new, empty row
below. If you use the arrow keys to move the cursor onto that new row, then
off again (down, then back up) everything is okay, if you repeat this process
(arrow back down to the new, empty row and back up again) the error occurs.
I suppose this must have something to do with what I am, or am not doing
with the custom collection but I've just built a really simplified version of
this, with just a couple of properties in the custom entity and no code other
than the basics in the collection (add, remove elements etc) and the error
still occurs.
Any help would be greatly appreciated.
Thanks in advance.
sometime now, but can no longer continue to ignore :-(
I've created a custom entity class which implements IEditableObject. I have
then created a custom collection for this custom entity which naturally
inherits CollectionBase and implements IBindingList.
When I bind my custom collection to a DataGridView and started editing, it
works correctly only up to the point where you try to navigate off a newly
created (but empty) grid row - the second time, at which point it errors with
an ArgumentOutOfRange exception.
The stack trace indicates the error occurs in the GetCellDisplayRectangle
event and that the parameter name (of the invalid parameter) is rowIndex.
I'll try to explain a little better. If you add a row, by typing in some
values, the grid puts that row in "edit" mode and displays a new, empty row
below. If you use the arrow keys to move the cursor onto that new row, then
off again (down, then back up) everything is okay, if you repeat this process
(arrow back down to the new, empty row and back up again) the error occurs.
I suppose this must have something to do with what I am, or am not doing
with the custom collection but I've just built a really simplified version of
this, with just a couple of properties in the custom entity and no code other
than the basics in the collection (add, remove elements etc) and the error
still occurs.
Any help would be greatly appreciated.
Thanks in advance.