Providing Custom Validation

Following what you learned in Chapter 27, you can provide custom data validation on entities. For example, imagine you want to validate the user input on the ShippedDate order’s property ensuring that its value is not greater than today’s date. To accomplish this, add a new partial class named Order and manage the OnShippedDateChanging partial method as follows:

image

Now switch back to the code for the main form and add the following event handler associated to the OrdersBindingSourceControl that allows handling exceptions in a user interface-oriented fashion:

You can then eventually add custom validation for any other ...

Get Visual Basic® 2010 Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.