Ryan "Walter Wang [MSFT]" Hi Ryan, Thank you for your post.
Perhaps a try-catch block that does nothing in the catch block is the way to go (since the Error Provider handles informing the user of the input error).
I am using a binding navigator and, when you click on one of the buttons (forward, back, etc), it changes to a different record in the dataset.
I have a method that has to happen with the new data when the user gets to a new page.
I have the data source connected, dropped controls on the form, put the basic logic in place, no problems there.
Even figured out that I need to manually save the data back to the database using table Adapter Manager. My current problem, which I've been unable to find a resolution to after much googling, is how to validate my data entry before allowing the user to leave the current record.
Microsoft is conducting an online survey to understand your opinion of the Msdn Web site.
Application throws an exception and the record is lost.
What event can I intercept, or what function do I need to override to do pre-navigation validation of my form's data and cancel navigation if the data is invalid in some way?
But you can also catch the exception and then write out the errors to some logging store or the console: as it works in all kind of applications, not only console applications (thanks to @Bart for his note in the comments below). Large image Here's how you can check the contents of the Entity Validation Errors in Visual Studio (without writing any extra code) i.e. You are right, the Visual Studio debugger's View Details Popup doesn't show the actual errors inside the Try Catch ex As Db Entity Validation Exception For Each a In ex. For example, if you put a break point in the catch, you can throw the following into a watch: Put a breakpoint on if statement. On every value you can see if there is an error and even the error message. When you don't need it anymore, just delete or comment the line. If asked, I can provide detailed screenshot in the debug window. Within my db Configuration.cs, I like to wrap my context.
For web applications that are in production and that use Elmah for exception logging it turned out to be very useful for me to create a custom exception and overwrite Just to extend an elegant solution. Entity Validation Errors The watch expression @zairja I haven't tested it in vb.net, but it appears that the variable is defined for as well in msdn.microsoft.com/en-us/library/ms164891.aspx, however the cast is probably not defined for vb.net, and instead you should probably do Direct Cast ($exception, System. Save Changes() method into a try/catch and produce an output text file that allows me to read the Error(s) clearly, and this code also timestamps them - handy if you run into more than one error at different times!