I have a DataViewGrid that is tied to a datasource. When the UserDeletingRow event is executed it allows a row to be deleted from grid and database.
But when executed it abends the program in the frmMain with System.IndexOutOfRangeException occurred.
I have tried to place try and catch code around the delete processing but the code executes completely before the frmMain termination.
I have even added try catch logic around the Application.Run(new frmMain()); and I still cannot catch the error.
Surely there is a way to use UserDeletingRow with a delete stored proc and reload the updated datatable into the grid, right?
Any help is most welcome. I will attach code upon request.
I figured this out just a few minutes ago. 1 1/2 days shot but I found that I was referencing the datatable after deleting the record and that was causing the -1 indexing problem. I thing the strangest thing was how I could not catch the error because it was being thrown in the Application.Run in the Main form.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.