thanks so much x77. My save method gets called from several places including other forms, so I just used your:
MyBindingSource.EndEdit()
and that appears to have solved the problem
Main Topics
Browse All TopicsI am using vb 2008 and LINQ to SQL to create a windows forms application that connects to a SQL database. On my form, I have several data-bound text boxes via a binding control that connect to my database via LINQ to SQL classes. My issue is that if a user is editing a text box and then clicks my save button, which commits the changes to the database by calling the submitchanges method on the datacontext, the changes the user made in that text box are not applied. If the user clicks out of the textbox first, and then invokes the save, everything works fine.
Thanks in advance for any ideas.
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Business Accounts
Answer for Membership
by: x77Posted on 2009-11-08 at 09:59:30ID: 25771205
1 - Verify properties of Save Button - CausesValidation = true
)
Me), PropertyManager)
This ensure that all binded textboxes are validated before the buton.click event fired.
Do'nt use MouseDown/Up of Save Button as action to commit the changes.
2 - Also you can force the validation and force EndEdit
SaveButton_Click(....
If ValidateChildren() = False Then Return 'No save unvalidated data.
try
MyBindingSource.EndEdit() ' if you have BindingSource
PropMgr.EndCurrentEdit() ' if you have PropertyManager
Catch ex As Exception
MessageBox.Show(ex.Message
Return False
End Try
Note, this only is valid if validation throw exceptions or you use the e.Cancel = true on validation events.
You also can use the EndEdit of BindingSource / PropertyManager.
To Get the PropertyManager On FormLoad you can write..
Private WithEvents PropMgr As PropertyManager
Sub Form_load....
PropMgr = DirectCast(BindingContext(