I have a data entry screen using controls bound through a bindingSource,
TableAdaptor and a BindingNavigator to move through the records.
When I have an data entry error (such as Null for a value) I get the
following error raised all the way to the App.Run command.
This is not a dataGridView, so I can not use that DataError event to catch it.
I have tried the BindingSource_DataError event, but that does not seem to
get fired.
There is no code (That I have written at least) that I can place a break
point on when I click the Previous button on the BindingNavigator which is
what I am doing just before the error occurs. To simulate the problem just
drag a table from your Data Sources list using the "Details" option not the
DataGridView. This will put the controls on the form and a BindingNavigator
at the top. Run the application, click on the "+" sign on the
BindingNavigator then just click the MovePrevious button without filling in
any fields. You should get an error on your App.Run command that says some
field can not be null.
The relevant stack trace is below:
at System.Data.DataColumn.CheckNullable(DataRow row)
at System.Data.DataTable.RaiseRowChanging(DataRowChan geEventArgs args,
DataRow eRow, DataRowAction eAction, Boolean fireEvent)
at System.Data.DataTable.SetNewRecordWorker(DataRow row, Int32
proposedRecord, DataRowAction action, Boolean isInMerge, Int32 position,
Boolean fireEvent, Exception& deferredException)
at System.Data.DataTable.InsertRow(DataRow row, Int32 proposedID, Int32
pos, Boolean fireEvent)
at System.Data.DataView.FinishAddNew(Int32 currentIndex, Boolean success)
at System.Data.DataRowView.EndEdit()
at System.Windows.Forms.CurrencyManager.EndCurrentEdi t()
at System.Windows.Forms.CurrencyManager.ChangeRecordS tate(Int32
newPosition, Boolean validating, Boolean endCurrentEdit, Boolean
firePositionChange, Boolean pullData)
at System.Windows.Forms.CurrencyManager.set_Position( Int32 value)
at System.Windows.Forms.BindingSource.MovePrevious()
at System.Windows.Forms.BindingNavigator.OnMovePrevio us(Object sender,
EventArgs e)
Any ideas where I can handle this error?
Gregory McCallum, MCSD
gm*******@honovi.com