I've discovered an odd behavior of the DateTimePicker which I frankly think is a bug in the control. I'm working in VB 2003, but I've verified this happens in VB 2005 as well. If you enter a single digit for a day or month, and don't change anything else in the date, the ValueChanged event doesn't fire until after the Validating and Validated events. I can understand why the event doesn't fire as soon as the digit is entered, since one might be entering two digits. But the fact that it doesn't fire until after the Validating event means there is no way to validate such input--when Validating fires, the old value is still present as the .Value property.
The only way I can find to have a subroutine run after the value has truly changed is to put something in LostFocus. That's workable for some of my needs. However, I seem to be out of luck in one use: putting a custom DateTimePicker control into a DataGridColumnStyle. I'm more or less using Microsoft's example from http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemwindowsformsdatagridcolumnstyleclasstopic.asp
, which for everything else seems to be doing a good job. But if a single-digit day or month is entered and then the user leaves the DTP, the change is lost. (The value isn't changed before the Commit method fires.) Further experimenting indicates that if one types either a leading zero or a trailing slash (to make a two-digit day/month or to indicate the end of the day/month and moving on to the next part of the date), that will fire the ValueChanged event. Is my only solution user education to do one of those things, or is there another way to get the value changed before Validating/Commit fires?