MultiRow Windows Forms > Developer's Guide > Using MultiRow > User Input Validation > Built-in Cell Validators > EncodingValidator |
You can use the EncodingValidator class to validate whether a cell's value matches the specified encoding type. A validation error occurs if the cell's value contains characters that do not match the specified encoding type.
Use the following instructions to validate a cell's value by comparison.
The following code illustrates the validation error when characters other than Unicode are entered in the cell.
Imports GrapeCity.Win.MultiRow Dim textBoxCell1 As New TextBoxCell() Dim encodingValidator1 As New EncodingValidator() encodingValidator1.Encoding = System.Text.Encoding.GetEncoding("Unicode") encodingValidator1.Actions.Add(New LineNotify()) textBoxCell1.Validators.Add(encodingValidator1) Dim cells As Cell() = {textBoxCell1} GcMultiRow1.Template = Template.CreateGridTemplate(cells) GcMultiRow1.RowCount = 10 |
using GrapeCity.Win.MultiRow; TextBoxCell textBoxCell1 = new TextBoxCell(); EncodingValidator encodingValidator1 = new EncodingValidator(); encodingValidator1.Encoding = System.Text.Encoding.GetEncoding("Unicode"); encodingValidator1.Actions.Add(new LineNotify()); textBoxCell1.Validators.Add(encodingValidator1); Cell[] cells = { textBoxCell1 }; gcMultiRow1.Template = Template.CreateGridTemplate(cells); gcMultiRow1.RowCount = 10; |