Click here to Skip to main content
15,882,113 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello All,

Please help.. 

In my project i have datagridview and i have created a cellValidate event of it and in it i have put the code of e.cancel = true for certain condition like formatting and decimal validation... 

now it gives error when i press MDI form's save button to save grid records... 

IT shows... exception "Operation did not succeed because the program cannot commit or quit a cell value change"

if i remove e.cancel = true or put e.cancel = false then exception is not occurred but it can saves wrong data in database....

Please help....

Thanks in advance... 


What I have tried:

i have tried e.cancel = false in cell validate event.. by using it , not throws exception but it can save false data to database without formatting...
Posted
Updated 16-Dec-19 1:23am

1 solution

That is by design: it's is exactly what the Validation event is there for.
If the data in the cell isn't valid, it shouldn't be saved - and that is exactly what the system is trying to do: prevent invalid data getting into your backing storage.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900