I use the following code to save the selection of a combobox to the SQL server and then filling a datetimepicker with the according value:
var comboboxSelection = Context.SomeEntityA.First();
Context.SomeEntityA.Update(comboboxSelection); comboboxSelection.SomeMember = projectIdentifier; Context.SaveChanges(); var someList = new List<SomeEntityB>(); someList = Context.SomeEntityB.ToListAsync(); private BindingSource _someBindingSource = new BindingSource(); _someBindingSource.DataSource = someList; datetimepicker1.DataBindings.Clear(); datetimepicker1.DataBindings.Add("Value", _someBindingSource, "StartMonth");
What do I have to do to save the selected date of the datetimepicker to the server on ValueChanged event? The following code won't work:
private void datetimepicker1_ValueChanged(object sender, EventArgs e)
{
Context.SaveChanges();
}