Cancelling a new row in an unbound datagridview

  • Thread starter Thread starter Kelllisa
  • Start date Start date
K

Kelllisa

When a user adds a row to an unbound datagridview, then clicks out of
the row (or the control loses focus for any reason) without entering
anything, I would like to have the row automatically deleted. However,
I cannot find an appropriate event to handle this case. Using
CellEndEdit results in a re-entry, and CellValidating/Validated and
most other events result in an InvalidOperationException.

Does anyone know where I could put this logic?

Thanks.
 
Maybe grid's Leave event will help you.

In this event handler function, you can get all grid items and check
the last item whether it is empty.

Hope it works.

Sincerely,
simida


(e-mail address removed) 写é“:
 
That might help; although I will need to handle the case where the user
clicks or arrows to another row in the grid, and not out of the control
entirely. I will give it a shot.

Thanks for your help
 
Back
Top