FlexGrid for WinForms
Validation
Show AllShow All
Hide AllHide All

In many cases, edit masks alone are not enough to ensure that the data enters by the user was valid. For example, a mask won't let you specify a range of possible values, or validate the current cell based on the contents of another cell.

In these cases, trap the ValidateEdit event and see if the value contained in the Editor.Text property is a valid entry for the current cell (at this point, the cell still has the original value in it). If the input is invalid, set the Cancel parameter to True and the grid will remain in edit mode until the user types a valid entry.

For example, the code below validates input into a currency column to ensure that values entered are between 1,000 and 10,000:

To write code in Visual Basic

To write code in C#

See Also

 

 


Copyright © GrapeCity, inc. All rights reserved.

Product Support Forum |  Documentation Feedback