To save changes made to a datagrid do the following;
- call endedit on the grid
- call update on the tableadapter, with the datasource as parameter.
In the example below the tablename in the database is named __Global_Settings, which is part of the Webgeneratordataset
' --- End editing on the grid, and save changes
' to the attached dataset
DataGridView1.EndEdit()
__Global_SettingsTableAdapter.Update(WebGeneratorDataSet)
MsgBox("Saved")
To save changes made to a data bound form, you can do almost the same:
- Call validate on the form
- call endedit on the bindingdource
- call update on the tableadapter