Quantcast
Channel: Windows Forms Data Controls and Databinding forum
Viewing all articles
Browse latest Browse all 2535

SaveChanges of datetimepicker on ValueChanged

$
0
0

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();
}


Viewing all articles
Browse latest Browse all 2535

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>