MultiRow Windows Forms > Developer's Guide > Using MultiRow > User Input Validation > Built-in Cell Validators > PairCharValidator |
You can use PairCharValidator and validate if the pair characters included in the cell value match each other. For example, you can validate if you have forgotten to put a closing bracket.
Complete the following steps to validate pair characters. The example displays a validation error when any bracket does not have its corresponding pair.
The following code displays a validation error when text entered in a cell does not have the corresponding bracket.
Imports GrapeCity.Win.MultiRow Dim textBoxCell1 As New TextBoxCell() Dim pairCharValidator1 As New PairCharValidator() Dim parChar1 As New PairChar("(", ")") pairCharValidator1.PairChars.Add(parChar1) pairCharValidator1.Actions.Add(New LineNotify()) textBoxCell1.Validators.Add(pairCharValidator1) Dim cells As Cell() = {textBoxCell1} GcMultiRow1.Template = Template.CreateGridTemplate(cells) GcMultiRow1.RowCount = 10 |
using GrapeCity.Win.MultiRow; TextBoxCell textBoxCell1 = new TextBoxCell(); PairCharValidator pairCharValidator = new PairCharValidator(); PairChar pairChar1 = new PairChar('(', ')'); pairCharValidator.PairChars.Add(pairChar1); pairCharValidator.Actions.Add(new LineNotify()); textBoxCell1.Validators.Add(pairCharValidator); Cell[] cells = { textBoxCell1 }; gcMultiRow1.Template = Template.CreateGridTemplate(cells); gcMultiRow1.RowCount = 10; |