I am using vb.net.
I have a datagridview with four columns.
The last two columns which are named Debit and Credit. Under the designer, I set the format to currency with two decimal places.
Now when I enter any whole or double values and after I leave the cell, immediately the number gets a currency symbol next to it.(Which is what I wanted and is working properly)
But when I delete the number and try to move to another cell, I get the "DatagridView Default Error Dialog" and within that error message dialog and at the end of the dialog box I get the following statement saying that to use the "DataError Event" to handle the problem.
After I use that event , I was able to avoid the error. and within that event I tried to replace the cell value to 0 or 0.0 if the user deleted the value and leave the cell.
But by doing that it did not work. I didn't get any errors, but the value 0.0 was not printed on the cell. I have given a detailed information about that event below:
First I got the current cell's column and row index to get the value from the cell. the value that showed was the value that was deleted from the cell.
So after that I wanted to replace that null or white space or empty cell with a value of 0.0 at the data error event.
But the value was not printed in the cell, and after that I checked the value on a messagebox, and it showed that the value was 0. but even then the cell was empty. Also when I tried to move to another cell, the data error event was getting fired again and again.
Could you please help me to solve this problem.
Thanks in advance.