'Adding new row bound to a bindingsource
I have several fields bound to a bindingsource,and i want to add a new row that shows empty on the DataGridView,all fields will be empty as well, Then when the user edits a field the data changes on the new row.
I can do that on a previously existing row ,as well as updating the database ,but I can’t do it with a new row.
If I use bindingSource.AddNew(); I get an error (the column N can’t be null).
Because it calls bindingSource.EndEdit() immediately so I can’t edit on the fields.
If I use : DataRow dr = dataSet.Tables["tb"].NewRow();
My fields will not be bound to the bindingsource ,and I can’t have the changes on the new row.
Thanks .
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
