There are some columns in the ultragrid(in winform), one column is POQty and the other column is RecQty, and they must be positive number,Now after input the value in the RecQty column,if the value of RecQty is greater than the value of POQty,then show a warning message .
By the way, is there a property of ultragrid to set the column only accept postive number?
Many thanks
I guess it depends on what your wingrid’s data source is to go about this. Assuming you were using an ADO data table as the wingrid’s datasource, I would create a validation method that hooks into the data table’s row changed event to check and see if the RecQty column value is greater than the POQty column value and then if necessary use the data row’s Set Column Error method with the error message. But in order for the gird to display the message you have to make sure to set the wingrid’s SupportDataErrorInfo property to CellsOnly or RowsAndCells else the grid will ignore the error information.
If you are trying to do something simple then you can just use the grid’s AfterRowUpdate event and then examine the two columns and respond appropriately.
You can prevent the user from entering negative numbers using the wingrid designer going to the appropriate band and columns section. Each column has a MaskInput property that you can set. The mask will for the user to enter information in the format you specify. Alternatively, you can use something like the Numeric Editor control and set it's mask to not allow negatives and then set the wingrid column's EditorControl property to that control and the cell will effectively host the specified control as the editor.
How does that sound?