MultiRow Windows Forms > Developer's Guide > Using MultiRow > User Input Validation > Built-in Cell Validators > IncludeListValidator |
You can use IncludeListValidator and validate if a cell's value is one of the values in the specified list. A validation error occurs if the value does not match any of the values in the list.
Complete the following steps to set a list of values. The following example uses a TextBoxCell1 for which a validation error occurs if a string other than Tokyo or Osaka has been entered. Blank characters are recognized as validation errors.
The following code displays a validation error when text other than Tokyo or Osaka is entered. The blank character is also recognized as a validation error.
Imports GrapeCity.Win.MultiRow Dim textBoxCell1 As New TextBoxCell() Dim includeListValidator1 As New IncludeListValidator() includeListValidator1.Candidates = New String() {"Tokyo", "Osaka"} includeListValidator1.Actions.Add(New LineNotify()) textBoxCell1.Validators.Add(includeListValidator1) Dim cells As Cell() = {textBoxCell1} GcMultiRow1.Template = Template.CreateGridTemplate(cells) GcMultiRow1.RowCount = 10 |
using GrapeCity.Win.MultiRow; TextBoxCell textBoxCell1 = new TextBoxCell(); IncludeListValidator includeListValidator1 = new IncludeListValidator(); includeListValidator1.Candidates = new string[] { "Tokyo", "Osaka" }; includeListValidator1.Actions.Add(new LineNotify()); textBoxCell1.Validators.Add(includeListValidator1); Cell[] cells = { textBoxCell1 }; gcMultiRow1.Template = Template.CreateGridTemplate(cells); gcMultiRow1.RowCount = 10; |