LINQ datasource and BindingNavigator update deosn't work

1.1k Views Asked by At

I'm trying to set a LINQ query as the DataSource of a BindingNavigator control.

In the form's variables I added a data context:

`Private c

tx As New myDataManagerDataContext`

The following code allows me to display and navigate through the results:

Dim clubList = From c In ctx.clubs _
                   Select c

BindingNavigator1.BindingSource.DataSource = clubList

Each record is displayed nicely so far. In the Winform, all textboxes are duly binded to the datasource but my problem is:

I added a Save ToolboxButton with: ctx.SubmitChanges()

But it doesn't process any update!

Question: Do I HAVE to write a complete Insert/ Update Linq procedure in the Save button?

Like:

Dim newClub as new DataContext.Club newClub.Name = NameTextBox.Text newClub.Address.... Etc.

1

There are 1 best solutions below

1
On

Try to call EndEdit on binding source just before save operation to happen.