N
NetNewbie
Hi, I have the following code in the Dataerror event of all the grids in my
application.
If (e.Context = DataGridViewDataErrorContexts.Commit) Then
MessageBox.Show("Error Saving Data")
End If
MessageBox.Show(e.Exception.Message, "Exhibit Dates",
MessageBoxButtons.OK, MessageBoxIcon.Error)
e.Cancel = True ' Keeps the focus on the same row
e.ThrowException = False
With this code, if I enter a row and then don't fill in all the values (or
have somthing that violates a condition), then I cannot click on the
bindingnavigator delete button to clear the row.
I wanted to use the e.cancel to keep the focus on the row in case user would
like to correct/edit the record. But if the user chooses to cancel the edit
operation or not save the incorrect row (and choose to remove it) then the
code doesn't allow one to remove the row .
Any suggestions on how to better handle this?
Thank you,
application.
If (e.Context = DataGridViewDataErrorContexts.Commit) Then
MessageBox.Show("Error Saving Data")
End If
MessageBox.Show(e.Exception.Message, "Exhibit Dates",
MessageBoxButtons.OK, MessageBoxIcon.Error)
e.Cancel = True ' Keeps the focus on the same row
e.ThrowException = False
With this code, if I enter a row and then don't fill in all the values (or
have somthing that violates a condition), then I cannot click on the
bindingnavigator delete button to clear the row.
I wanted to use the e.cancel to keep the focus on the row in case user would
like to correct/edit the record. But if the user chooses to cancel the edit
operation or not save the incorrect row (and choose to remove it) then the
code doesn't allow one to remove the row .
Any suggestions on how to better handle this?
Thank you,