| MultiRow Windows Forms > Developer's Guide > Using MultiRow > User Input Validation > Built-in Cell Validators > CompareStringValidator |
You can use the compare string validator to validate whether a cell's value matches the specified conditions. A validation error occurs if the value does not match the specified conditions.
Complete the following steps to validate a cell's value by comparison.
The following code illustrates the validation error when a string other than "AAA" is entered in the cell. Blank text is also recognized as a validation error.
Imports GrapeCity.Win.MultiRow
Dim textBoxCell1 As New TextBoxCell()
Dim compareStringValidator1 As New CompareStringValidator()
compareStringValidator1.ComparedOperator = CompareStringValidatorOperator.Equals
compareStringValidator1.ComparedString = "AAA"
compareStringValidator1.Actions.Add(New LineNotify())
textBoxCell1.Validators.Add(compareStringValidator1)
Dim cells As Cell() = {textBoxCell1}
GcMultiRow1.Template = Template.CreateGridTemplate(cells)
GcMultiRow1.RowCount = 10
|
using GrapeCity.Win.MultiRow;
TextBoxCell textBoxCell1 = new TextBoxCell();
CompareStringValidator compareStringValidator1 = new CompareStringValidator();
compareStringValidator1.ComparedOperator = CompareStringValidatorOperator.Equals;
compareStringValidator1.ComparedString = "AAA";
compareStringValidator1.Actions.Add(new LineNotify());
textBoxCell1.Validators.Add(compareStringValidator1);
Cell[] cells = { textBoxCell1 };
gcMultiRow1.Template = Template.CreateGridTemplate(cells);
gcMultiRow1.RowCount = 10;
|