This may be a NET bug, but maybe I'm missing something. I've been trying to trap a certain kind of error when using a DataGridView. The following describes the steps to generate the error. I used a typed dataset to make the example quick, but the same thing happens if an untyped dataset is used.

Create a new application.
Use the Add New Datasource dialog to add typed dataset with any table which has at least one column with a constraint. Drag the table from the Data Sources window to your form. Designer will add a datagrid and navigator with the support data objects.
Run the program.
Click the Add new button on the navigator to create a new blank record.
Click on any other row in the grid. You will get an exception from the datagrid becuase the constraint was violated. The message displayed is nothing you want your users to try to comprehend. Also, the new record apparently is deleted.

When this kind of error happens, it would be much better to display a civilized error message to the user and then return to the record which was being added. I have spent two days trying to find the right way to do that. Any ideas would be appreciated.

ps-a hint about my login - I used to run a salmon hatchery.

Thanks. The first, using cell validation, would have required events for every cell so I didn't try it. The second, using the DataError event, works for me.

This question has already been answered. Start a new discussion instead.