InvalidCastException when you bind DateTimePicker that contains a null value in Visual Basic
Jan.13, 2010 in
exception
Symptoms
When you bind a DateTimePicker control to a data source, you may receive the following error message:
An unhandled exception of type ‘System.InvalidCastException’ occurred in mscorlib.dll
Additional information: Object cannot be cast from DBNull to other types.
Resolution
This behavior occurs if the field that is bound to the DateTimePicker control contains a null value that is represented by the System.DBNull object. The DateTimePicker control does not support the System.DBNull object.

Leave a Reply