Home › Forums › WinForms controls › Xceed Grid for WinForms › An attempt was made to select a row that does not belong… › Reply To: An attempt was made to select a row that does not belong…
I am also struggling with this exception. It is beyond me why you would trow such an exception for such a simple error. I cant seem to be able to trap it. My application starts from a Sub Main and I have Try Catch clauses around all of my code and this exception gets thrown all the way up to the Sub Main exception handler. there are several instances where the Grid is throwing exceptions like this and it is starting to hamper development.
For my case because of auditing requirements every cell edit must be saved immediately to the database. So I handle the EditLeft event, call my SP, the return of which is a n new data set, each edit may impact several rows and columns so we have to get a new data set back. Well, all works well until the user clicks off of the current row to another row to commit the data. This throws the exception noted above since it is trying to set the selected row to the one the user selected but since I had to unbind and rebind the data set it no longer exists.
I would respectfully request that Xceed reconsider throwing such exceptions in a manner that we can not catch. Or provide a way to turn off such exceptions when we need to. I mean is it really that huge of an issue if the grid can not reselect the row? Why not just raise an event that we can handle and let us decide what is an application terminating event.
I have come to rely on the flexibility of the Xceed grid, but exceptions like this and the exception that is thrown when I cancel an edit of a cell through code is starting to be a real issue for us.
What can I do to resolve this?
I am currently using the Application.Idle event but I do not like the fact that I really don’t know when that event will fire, I know it is almost immediate but it is not a deterministic as I need for this application.
Imported from legacy forums. Posted by Brian (had 3565 views)