473,407 Members | 2,326 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

How do you catch an error from a data bound entry screen

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
Aug 18 '06 #1
2 4505
Is there anyone that uses databound controls (excluding the dataviewgrid)? I
can not see how anyone is able to create a data entry screen using bound
controls if you can not trap data errors. I have reported this problem to
Microsoft as a bug and still have not got a response from them.

There must be a way to stop the application from crashing by trapping the
data entry errors. Has anyone successfully done this?

-Gregory McCallum, MCSD
gm*******@honovi.com
"gmccallum" wrote:
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
Aug 22 '06 #2
I don't know if any other version of Visual Studio does this, but VS2K5
creates xsd (XML Schema) files for tables when you create DataSets with
it. I would guess that it does something similar when you drag and
drop data bound controls. Check your project directory to see if there
are any. You will be astounded at how much code gets created in
support of binding! That's a good place to start.

gmccallum wrote:
Is there anyone that uses databound controls (excluding the dataviewgrid)? I
can not see how anyone is able to create a data entry screen using bound
controls if you can not trap data errors. I have reported this problem to
Microsoft as a bug and still have not got a response from them.

There must be a way to stop the application from crashing by trapping the
data entry errors. Has anyone successfully done this?

-Gregory McCallum, MCSD
gm*******@honovi.com
"gmccallum" wrote:
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
Aug 22 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Iain Miller | last post by:
Struggling a bit here & would be grateful for any help. I have a table which has a list of people in it. Each person has a unique ID automatically allocated by Access but also belongs to one of 5...
13
by: deko | last post by:
I use this convention frequently: Exit_Here: Exit Sub HandleErr: Select Case Err.Number Case 3163 Resume Next Case 3376 Resume Next
6
by: Wayne | last post by:
I am designing a database which needs approximately 50 fields per record. The database user requires data entry to be via a single screen. If I follow good database design practice and split the...
16
by: jhwagner | last post by:
I need to use double data entry with an MS Access database. I have read many arguments and reasons against this on this group but I have to do this. I have seen various tips on how this can be...
6
by: Brian Blair | last post by:
I have created a input form that enters a number in a talble. If I open the form again it enters a new record instead of editing the existing record. It seems like it should be very basic but I...
2
by: Mark | last post by:
I have a form with two sub forms. The form is set to data entry. The form is bound directly to a table I have two buttons at the bottom of the screen. One button is named reject and one is named...
22
by: Amali | last post by:
I'm newdie in c programming. this is my first project in programming. I have to write a program for a airline reservation. this is what i have done yet. but when it runs it shows the number of...
1
by: admin.offshoredataentry | last post by:
Data Entry Outsourcing provides time bound, cost effective and qualitative Data Entry also provides numeric data entry, textual data entry, image data entry, data format, data conversion and also...
5
by: kellygreer1 | last post by:
I think I'm not quite understanding something about error handling in PHP5. I have written some PHP code to index the contents of C drive on a Windows machine. When it gets to certain special...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.