| MultiRow Windows Forms > Developer's Guide > Using MultiRow > User Input Validation > Built-in Cell Validators > RegularExpressionValidator |
You can use RegularExpressionValidator and validate if a cell's value matches the specified regular expression. For further details about Regular Expressions, refer to
.NET Framework Regular Expressions.
Complete the following steps to validate using a regular expression. The example displays a validation error if a string other than an e-mail address has been entered in the textBoxCell.
The following code displays a validation error if a string other than an e-mail address has been entered in the cell.
Imports GrapeCity.Win.MultiRow
Dim textBoxCell1 As New TextBoxCell()
Dim regularExpressionValidator1 As New RegularExpressionValidator()
regularExpressionValidator1.Expression = "\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"
regularExpressionValidator1.Actions.Add(New LineNotify())
textBoxCell1.Validators.Add(regularExpressionValidator1)
Dim cells As Cell() = {textBoxCell1}
GcMultiRow1.Template = Template.CreateGridTemplate(cells)
GcMultiRow1.RowCount = 10
|
using GrapeCity.Win.MultiRow;
TextBoxCell textBoxCell1 = new TextBoxCell();
RegularExpressionValidator regularExpressionValidator1 = new RegularExpressionValidator();
regularExpressionValidator1.Expression = @"\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*";
regularExpressionValidator1.Actions.Add(new LineNotify());
textBoxCell1.Validators.Add(regularExpressionValidator1);
Cell[] cells = { textBoxCell1 };
gcMultiRow1.Template = Template.CreateGridTemplate(cells);
gcMultiRow1.RowCount = 10;
|