Question

I have bindingList bound to TextBoxes. When I enter new value in textboxes and press save button the value from last Textbox dosen't save in database. But when I pressed Tab key before save button every values from texboxes were saved. How resolve this problem with unsaved last value?

....

BindingList<Zamo> myList;
pg = new PGEntities();
var query = (from zam in pg.Zamo where zam.ID == rekord.ID).Take(1);
myList = new BindingList<Zamo>(query.ToList());
zamoBindingSource.DataSource = myList;   

....

private void SaveButton()
{
    pg.SaveChanges();
}

This occurs only when I save by button in BindingNavigation.

Was it helpful?

Solution

When you press the tab key it is getting saved? that probably means the saveButton event is reading the text before the entered text is considered. Try to lose focus on the textbox, then save.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top