I have a small demo WinForms app. One of the Forms is my Add New Person form. I used the Details View instead of the
public partial class AddPersonForm : Form
private readonly DemoContext _context;
_context = new DemoContext();
protected override void OnLoad(EventArgs e)
personBindingSource.DataSource = _context.People.Local.ToBindingList();
private void personBindingNavigatorSaveItem_Click(object sender, EventArgs e)
int changes = _context.SaveChanges();
Debug.WriteLine("# of changes: " + changes);
You don't need to change the position, in fact you need to call
BindingSource.EndEdit that applies pending changes to the underlying data source.
Changing the position causes the underlying currency manager calls
EndCurrentEdit and this is what the
EndEdit method of binding source does for you.