Hello,
I have a decimal column which I format using the column.format to 2 decimal places. I can see that this changes the text but not the underlying value. What
is the best way to round the underlying value? My database is crashing trying to save too many decimal places.
Do I have to use the IEditorDataFilter?
regards
Darren
So you want to prevent your users from entering more than 2 decimal places? In that case, you should use the MaskInput property on the column. Set it to something like:
"nnn.nn"
Thanks for the response Hristo. I'm using Sybase ASE 12 with the .NET Sybase drivers unfortunately. I tried using the BeforeCellUpdate but it doesn't seem to allow you to change the value.
I also tried BeforeExitEditMode but I also need to make sure that any calculated fields get rounded as well, as they will cause a crash too.
So I thought perhaps I could use the Datafilter , but so far I haven't gotten that to work.
Hello Darren,
What database are you using? Microsoft SQL Server automatically rounding decimal value, when scale of value is more than scale of the column. So your database shouldn’t be “crashing” if you are synchronize the type of what you insert with database type of the column where you insert.
If you want to rounding value of the cell you could use _BeforeCellUpdate event of the grid, and round cell value depends on your requirements.
Let me know if you have any further questions.