MultiRow Windows Forms > Developer's Guide > Using MultiRow > User Input Validation > Built-in Cell Validators > ExcludeListValidator |
You can use ExcludeListValidator and validate whether the cell's value matches the specified list of values. A validation error occurs if the value matches any of the values in the list.
Complete the following steps to set ExcludeListValidator. In the example, a validation error occurs if the text Air Mail or Sea Mail has been entered in the cell. Blank characters are not recognized as a validation error.
The following code displays a validation error when the specified text Air Mail and Sea Mail has been entered in the cell. Blank characters are not recognized as a validation error.
Imports GrapeCity.Win.MultiRow Dim textBoxCell1 As New TextBoxCell() Dim excludeListValidator1 As New ExcludeListValidator() excludeListValidator1.Candidates = New String() {"Air Mail", "Sea Mail"} excludeListValidator1.Actions.Add(New LineNotify()) textBoxCell1.Validators.Add(excludeListValidator1) Dim cells As Cell() = {textBoxCell1} GcMultiRow1.Template = Template.CreateGridTemplate(cells) GcMultiRow1.RowCount = 10 |
using GrapeCity.Win.MultiRow; TextBoxCell textBoxCell1 = new TextBoxCell(); ExcludeListValidator excludeListValidator1 = new ExcludeListValidator(); excludeListValidator1.Candidates = new string[] { "Air Mail", "Sea Mail" }; excludeListValidator1.Actions.Add(new LineNotify()); textBoxCell1.Validators.Add(excludeListValidator1); Cell[] cells = { textBoxCell1 }; gcMultiRow1.Template = Template.CreateGridTemplate(cells); gcMultiRow1.RowCount = 10; |