all groups > dotnet windows forms > july 2006 >
You're in the

dotnet windows forms

group:

Cancelling a new row in an unbound datagridview


Cancelling a new row in an unbound datagridview Kelllisa NO[at]SPAM gmail.com
7/30/2006 5:36:06 PM
dotnet windows forms:
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.
Re: Cancelling a new row in an unbound datagridview simida
7/30/2006 7:03:44 PM
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


Kelllisa@gmail.com =E5=86=99=E9=81=93=EF=BC=9A

[quoted text, click to view]
Re: Cancelling a new row in an unbound datagridview K
7/31/2006 3:38:20 PM
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

[quoted text, click to view]
AddThis Social Bookmark Button