skip to content »

specbooks.ru

Create datagridviewcellvalidatingeventargs

I have a parent form with one Data Grid View and a button.

Update: It appears it simply validates both when you are attempting to exit a row and when you are attempting to enter one.

So the real question would be how to stop it from running the function if it's entering the row.

If I try to create a new record, it triggers the validation event, sees that the First Name field on the new record is empty, and throws up my message box.

Is there any way to make solely use the information on the row it was leaving?

I'm using Cell Validated event and showing a message box whenever it inputs an invalid value.

Thanks, Matt Jeffrey Tan[MSFT] wrote: Hi Matt, Thanks for your post.

The problem is being unable to cancel the moving from row to row (and, as such, attempting to save the changes).As far as I can tell, the code on your site only helps with validating the data, not stopping the Row Leave event entirely.Regards, Matt Cor Ligthert [MVP] wrote: In many places in my application, I have a Data Grid View which users can either enter data into or use as a method of navigation in a master/detail form view.- This posting is provided "as is" with no warranties and confers no rights. So we should check the leaving row and validate it, if not valid, we can set e. Hope this helps Best regards, Jeffrey Tan Microsoft Online Partner Support Get Secure!Matt, I was having the same issue, and have found a work around (maybe not ideal, but it works).Again, I am sure this isn't the "perfect" solution, but after days of pounding my head against the wall, this is what I came up with.