Refreshing BindingSource after insert (Linq To SQL)

Posted by Armagan on Stack Overflow See other posts from Stack Overflow or by Armagan
Published on 2009-10-20T12:46:37Z Indexed on 2010/04/08 17:33 UTC
Read the original article Hit count: 491

I have a grid bound to a BindingSource which is bound to DataContext table, like this:

myBindingSource.DataSource = myDataContext.MyTable;
myGrid.DataSource = myBindingSource;

I couldn't refresh BindingSource after insert. This didn't work:

myDataContext.Refresh(RefreshMode.OverwriteCurrentValues, myBindingSource);
myBindingSource.ResetBinding(false);

Neither this:

myDataContext.Refresh(RefreshMode.OverwriteCurrentValues, myDataContext.MyTable);
myBindingSource.ResetBinding(false);

What should I do?

© Stack Overflow or respective owner

Related posts about winforms

Related posts about linq-to-sql