Datagridview rowvalidating delete, your answer
Initially, this worked just fine. A main table with a foreign key into a lookup table. Here is the code to set up the DGV. The Column number points to the DGVCombobox, and the Context bits decode to ormatting, Display Using the debugger to examine the details on the dataset, I noted that the primary key for the lookup table is defined as FullName of System.
Not sure where this belongs. The grid is bound to a filtered binding source. What's happening is when the data is saved, SQLServer appends Datagridview rowvalidating delete seconds as well.
The main table is displayed through textboxes on the form, and a separate Combobox displays the selected, and list of lookup values from the lookup table. What I want to do in DataError is give the user the choice of remaining in the row to fix it e. I have defined an error handler to trap the error and decode some information.
Question 1 - Any suggestion on how to handle the DataError event and avoid the loop?
Part of the primary key is set by one of the cells in the grid which is in combobox mode. No data relations have been defined in the dataset.
The DataError event checks to make sure that 4 columns in the row have been input - if they have not - a message is displayed - with specifics on the 4 columns. What gives me trouble is a newly added row I'm even sure 'new' is the right term, but it is newly added.
My main concern is duplicate keys.
DatagridView, handling DataError
The combobox cell is the only problem. However a minor change to the database column names not the data - has generated the invalid DataErrors. Which prompts another question 1.
I have tried deleting the DGV and recreating it. I tried to use a bunch of controls e. The resulting Datagridview rowvalidating delete value is the foreign key value of the main table.
DataGridView Class (app4shared.com)
The result is consistent and the same: How can I plug in before DataError? However the main table foreign key is defined as having FullName of System.
ThrowException is set to true - this prevents the MicrosoftLand loop - but gives me an ugly UnHandled exception error message.
The other row fields are either hidden or easy-to-validate text entry boxes handled in RowValidating. Question 2 - Where do you Catch the exception thrown by the e. After it goes through the DataError event - the code goes into a loop somewhere in MicrosoftLand.
This part of the form works fine. ResetBindings, or nothing for that matter.