# Using a Surrogate Character Validator

Learn how to create a surrogate character validator in this tutorial and take control of validation errors and actions in your spreadsheets.

## Content

You can create a validator that checks if surrogate characters have been entered in the cell
A validation error occurs if the value is not valid. You can also create an action, such as adding a backcolor to the cell, that lets the user know the value is invalid.
Use the **SurrogateCharValidator** class to create the validator. Specify a notification type such as [CellStyleNotify](/spreadnet/api/latest/online-win/FarPoint.Win.Spread/FarPoint.Win.Spread.CellStyleNotify.html). Then use the [AddValidators](/spreadnet/api/latest/online-win/FarPoint.Win.Spread/FarPoint.Win.Spread.SheetView.AddValidators.html) method to add the validator to a cell range.

## Using Code

The following example uses the surrogate character validator.

```csharp
FarPoint.Win.Spread.CellStyleNotify cnotify = new FarPoint.Win.Spread.CellStyleNotify();
                cnotify.InvalidCellStyle.BackColor = Color.Aqua;
                FarPoint.Win.Spread.SurrogateCharValidator surchar = new FarPoint.Win.Spread.SurrogateCharValidator();
                surchar.Actions.Add(cnotify);
                fpSpread1.Sheets[0].AddValidators(new FarPoint.Win.Spread.Model.CellRange(1, 1, 1, 1), surchar);
                fpSpread1.Sheets[0].Cells[1, 1].Value = "In the game of mahjong \U0001F01C denotes the Four of circles";
```

```vbnet
Dim cnotify As New FarPoint.Win.Spread.CellStyleNotify()
                cnotify.InvalidCellStyle.BackColor = Color.Aqua
                Dim surchar As New FarPoint.Win.Spread.SurrogateCharValidator()
                surchar.Actions.Add(cnotify)
                fpSpread1.Sheets(0).AddValidators(New FarPoint.Win.Spread.Model.CellRange(1, 1, 1, 1), surchar)
                fpSpread1.Sheets(0).Cells(1, 1).Text = "In the game of mahjong" + Char.ConvertFromUtf32(&H1F01C) + "denotes the Four Of circles"
```

## See Also

[Using a Cell Comparison Validator](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-interactcell/spwin-cellvalid/spwin-cellvalidation/spwin-cellcomparevalidator)
[Using a Character Format Validator](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-interactcell/spwin-cellvalid/spwin-cellvalidation/spwin-cellcharformatv)
[Using a String Comparison Validator](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-interactcell/spwin-cellvalid/spwin-cellvalidation/spwin-cellcomparestring)
[Using a Value Comparison Validator](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-interactcell/spwin-cellvalid/spwin-cellvalidation/spwin-cellcomparevalue)
[Using an Encoding Validator](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-interactcell/spwin-cellvalid/spwin-cellvalidation/spwin-cellencodingvalid)
[Using the Exclude List Validator](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-interactcell/spwin-cellvalid/spwin-cellvalidation/spwin-cellexcludevalidator)
[Using the Include List Validator](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-interactcell/spwin-cellvalid/spwin-cellvalidation/spwin-cellincludevalidate)
[Using a Pair Validator](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-interactcell/spwin-cellvalid/spwin-cellvalidation/spwin-cellpairvalidate)
[Using the Range Validator](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-interactcell/spwin-cellvalid/spwin-cellvalidation/spwin-cellrangevalidator)
[Using a Regular Expression Validator](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-interactcell/spwin-cellvalid/spwin-cellvalidation/spwin-cellregexpression)
[Using a Required Field Validator](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-interactcell/spwin-cellvalid/spwin-cellvalidation/spwin-cellrequiredvalid)
[Using a Required Type Validator](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-interactcell/spwin-cellvalid/spwin-cellvalidation/spwin-cellrequiretypev)
[Using a Text Length Validator](/spreadnet/docs/latest/online-win/overview/spwin-devguide/spwin-interactcell/spwin-cellvalid/spwin-cellvalidation/spwin-celltextlvalid)