Corresponding C# code
Here's some corresponding C# code:
I simply encoded the names of the specific binding source and data set because I wasn't sure how to make it independent like you did -- the "this" construct doesn't seem to have them, or if it does, I didn't immediately see where and didn't have time to dig.
- private void bindingNavigatorDeleteItem_Click(object sender, EventArgs e)
- {
- if (MessageBox.Show(
- "Are you sure you want to delete this record?",
- "Delete Record", MessageBoxButtons.YesNo) == DialogResult.Yes)
- {
- regionsBindingSource.RemoveCurrent();
- try {
- this.Validate();
- regionsBindingSource.EndEdit();
- tableAdapterManager.UpdateAll(aFGDevlDataSet);
- MessageBox.Show("The recordhas been deleted.");
- } catch (Exception ex) {
- MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
- }
- }
- }