Cellvalidating cancel edit

Thanks, I'm using Cell Value Changed currently on a grid with custom validation and have had no problems with display or anything else.

I used this event because I wanted to fire off a certain order of events, but only when the user changes the value of a cell.

I guess I could call On Cell Validating, but then I'd be worried I'm missing some other event. Keys) As Boolean Dim key As Keys = (key Data And Keys.

In my case, Cell Value Changed has done what I wanted/needed.EDIT The biggest thing about the Cell Validating event is that you can stop the user from leaving a cell, if the value entered does not pass your validation. What's the best place to implement validation logic code and conditional formatting code for a Data Grid View?In a lot of books and articles that I've read on this control, it seems to suggest that the appropriate event to handle for this is the Cell Validating one. However, this event triggers a bit too often for my tastes and I'm not sure it is required.I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing.

Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

You can also edit the contents of a cell by typing in the formula bar.

When you edit the contents of a cell, Excel is operating in Edit mode.

I'm using a Data Grid View in my Win Forms application. Process Dialog Key(key Data) End Function No, but you can manually fire the Cell Validating event. All events are is a class using the Observer Pattern, they're no different than any other method.

My main objective is to make the Enter key not move to the next row in the grid. If that doesn't work, you can create a Key Press event on the cell and emulate pressing Enter on the cell, but that may mess with the users UI, just put the carat back where it was.

If a cell doesn't satisfy some conditions in Cell Validating event, I want the cell's value to be changed to the old value when I leave the cell.