Binding b = new Binding( \"Value\", person, \"BdayNullable\", true );
dtBirthdayNullable.DataBindings.Add( b );
b.Format += new ConvertEventHandler( dtBirthdayNullab
Using Vs 2015 and having no luck binding a DateTimePicker control. The easiest thing seems to be simply not binding it- handle passing the value of your object to the control and from the control to your object manually. A few lines of code will save you lots of headaches...
private void BindData()
{
// can't bind the datetimepicker, so handle it manually...
if (o.myDate == null)
{
dtDatePicker.Checked = false;
}
else
{
dtDatePicker.Checked = true;
dtDatePicker.Value = o.myDate.Value;
}
}
private void Save()
{
if (dtDatePicker.Checked)
{
o.myDate = dtDatePicker.Value;
}
else
{
o.myDate = null;
}
}