I have a form and use it to add contact information to a database. Name, Address, etc. My question is there a way to cancel the addNew method.
clientBindingSource.AddNew()
Printable View
I have a form and use it to add contact information to a database. Name, Address, etc. My question is there a way to cancel the addNew method.
clientBindingSource.AddNew()
The short answer is CancelEdit.
The long answer is that calling AddNew creates a new DataRowView and adds it to the DefaultView of your DataTable without actually adding the corresponding DataRow to the DataTable itself. To commit the change and add the row you call EndEdit, while to rollback the change and discard the row you call CancelEdit. Note that, in bound controls, pressing the Escape key will invoke the CancelEdit method while navigating away from the row will invoke the EndEdit method.