Nathan,
>Now I'm working on a DataPicker control that can handle System.DBNull. The .Net DateTimePicker works fine with intitialized dates, but when adding new records, and there's date columns in the dataset that do not get intialized to a specific date, that control blows up trying to bind. I miss VFP's empty date, which I guess SQL doesn't have. Any suggestions there?
You can override the DatePicker's Value property like this:
public new object Value
{
get { return base.Value; }
set
{
if (value is DateTime)
{
base.Value = (DateTime)value;
this.Checked = true;
}
else if (value == DBNull.Value)
{
this.Checked = false;
}
else
{
throw new ArgumentException(
"Argument must be a DateTime or DBNull.Value");
}
}
}
I'll be adding this to the mmDatePicker class, but in the interim you can add this to your subclass of mmDatePicker.
Regards,
Kevin McNeish
Eight-Time .NET MVP
VFP and iOS Author, Speaker & Trainer
Oak Leaf Enterprises, Inc.
Chief Architect, MM Framework
http://www.oakleafsd.com