Hi!
I have a grid bound to a table, with a column called "Price" of type Int. In the CellUpdate event I'm treating the cases of when incorect data (negative, or characters) is inserted in a cell in that column. But before reaching the CellUpdate event the grid throws an error that a conversion error has ocurred, and only after this the cell update triggers. So I get 2 error messages, and I want to get rid of the first one, throws by the conversion error.
How could I solve this ?
Thanks!
There are several different approaches to this. One is to use character masking (see UltraGridColumn.MaskInput), whereby the cell disallows user entry of (for example) non-numeric characters.
Another approach is to handle the BeforeExitEditMode event, validate the value therein, and set the Cancel property of the event arguments to true if the value does not meet a certain criteria. If you do this, you'll want to use the UltraGrid.ActiveCell.EditorResolved.CurrentEditText property, which will give you the raw, unvalidated value entered by the user.
BeforeExitEditMode did the trick!
Thanks Brian!