Information générale
Catégorie:
The Mere Mortals .NET Framework
Titre:
DataGridView EndEdit() problem
I have a mmDataGridView with AllowUserToAddRow = True. It is bound to InvoicesItems which is a child of the primary table Invoices.
When I open the form, the Invoices business object is populated. No changes are made to the InvoicesItems business Object. I close the form and I get an error: There is no row at position 0
When I follow the error, I end up in mmBusinessForm.EndEdit(). When it calls EndEdit() on the individual rows for InvoicesItems, it gets a Position = 0 from this.BindingContext[...].Position, but there is are no rows in the table. When it calls dt.Rows[0].EndEdit() it throws an error because there is no row at position 0.
It looks like the Grid is reporting its position at row 0 because that is where the cursor is and data will be entered. But, since data has not been entered, no row has been created.
Any suggestions on solving this dilemma?
Thanks,
Jeff
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement