Error Handling in DatagridView
Posted on 2009-04-24
I have a Datagridview that is bound to a dataset.
The datagridview contains four columns:
1. Dropdownlist of Companies
2. Dropdownlist of Accounts
3. Textbox: Debit Amount
4. Textbox: Credit Amount
The dataset does not allow null values in the 1,2 column.
In the datasets Partial Class I've added Error Handling for this and they show up in the Datagridview as they should.
However, the user is allowed to leave the row even though there are errors on the rows columns. When this happens, the DataGridViews DataError event is thrown and the users row is deleted. How to avoid this? Is there a post row change event that can check for errors?