I've recently added some simple data validation to my grid which are a bunch of checks that look rather like this:
if (Convert.ToInt32(e.Row.Cells["Category"].Value) == 0)
e.Cancel = true;
e.Row.ErrorText = "Project Must have a Category";
at the end of the rowformatting event I have this:
if (MessageBox.Show(e.Row.ErrorText, "ERROR", MessageBoxButtons.OKCancel) == DialogResult.Cancel)
//TODO cancel row add
This gets the focus out of the AddRow section. However when I click on any other row, the event fires... but the row that it's referencing is still the new row data, which means that I get the error message again and again and again! How do I properly cancel the AddRow so that the gridView can return to it's default behavior?