DataGridView - How do I...
I have a DataGridView control in a Windows forms app bound to a datatable. I want the DataGridView to update the datatable as soon as a cell value is changed.
The default behaviour only seems to update the datatable when you move to a different row. Moving to a different cell or clicking a button outside the DataGridView does not cause the datatable to be updated. When the user clicks a button outside the DataGridView control I want to ensure that all changes have been committed to the datatable.
Your advice is appreciated.
When the user clicks a button outside the datagridview control, you might try calling the bindingsource's EndEdit method.
You might also try the following:
Select the grid in design mode.
From the Properties window, select Databindings | Advanced. Click the Ellipsis button in the Advanced property. This brings up the Formatting and Advanced Binding dialog.
Choose OnPropertyChanged from the Data Source Update Mode combo box.
Thanks for the suggestions.
Originally Posted by kmoorman
I'd already tried the EndEdit but without success. I'm binding programatically so the second suggestion wouldn't be applicable.
After some amount of frustration I found a solution. Call the forms Validate() method.
By heena patel in forum .NET
Last Post: 03-18-2008, 11:36 AM
By hellopraveen30 in forum .NET
Last Post: 02-14-2007, 01:01 AM
Last Post: 09-27-2006, 03:47 AM
By triley35 in forum .NET
Last Post: 07-08-2006, 12:34 AM
By TigerMoonSix in forum .NET
Last Post: 06-20-2006, 10:18 AM
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center