How can I validate that a value has been selected in a datetimepicker control.
The control is bound to a bindingnavigater so when the save button is clicked I want to ensure a date has been selected?
How can I validate that a value has been selected in a datetimepicker control.
The control is bound to a bindingnavigater so when the save button is clicked I want to ensure a date has been selected?
I would rather validate if the value makes sense (from your system's point of view), not if it was physically entered.
The easiest way to do this is to make a subclass of BindingNagivator which allows you to subscribe to the Validating event, and handle your validation, preventing the move.
A simple implementation is shown in this forum post (ValidatingBindingNavigator).
This allows you to validate prior to allowing a change in movement, or a save.