I found the answer actually. I just have to use the CancelEdit method (I thought that method was only available in the validation...turns out that is not the case).
Main Topics
Browse All TopicsI have a DataGridView which is populated by use of a bindingList (of T) (the T being a custom generic object). The user is allowed to edit certain columns. The underlying custom-object does the verification and if the verification fails an exception is thrown (by the custom object) which is caught by the DataGridView's 'DataError' subroutine (handles the dataerror event). The issue with these edits is this: when the DataError receives the error I can't cancel the edit. The command "e.cancel" doesn't roll back the value in the cell (like it does in the cellValueChanged routine). How can I do this (preferably without creating a global variable to track every cell value the user enters)?
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
I just want to bring up the point that handling the verification in my custom object (and letting the datagridview's dataerror routine handle the errors) seems to be more object-oriented in my eyes. I like the fact that the code that decides whether any input into a property of the custom class is contained...in that custom class.
What do you think?
If the discussion is around OOP, I tend to lean towards having a rules engine attached to each class, then have the class delegate the actual validation to the rules engine. :)
However, I'm also a bit paranoid. I work in an environment where we potentially have clients side-stepping the UI, so it's good to have validation in the classes. However, it's also desirable to do some validation in the UI, so that the bad data never needs to be validated. This is especially true if you're in a web/Silverlight application, where roundtrips to the business objects are time-consuming.
Business Accounts
Answer for Membership
by: ChaosianPosted on 2009-08-31 at 14:56:51ID: 25226897
I'd probably hang my validation on the Validating event. This should let you reject the change.
You also need to set e.Cancel = True. It's a property, not a method.