# Icon Set Rule

Spread for ASP.NET allows you to create Icon Set rule to display certain icons when a cell value is greater than, equal to, or less than a value.

## Content

You can set rules that display certain icons when a cell value is greater than, equal to, or less than a value.
You can use built-in icon sets for the rule. You can also specify individual icons to use in the icon set with the [IconRuleSet](/spreadnet/api/latest/online-asp/FarPoint.Web.Spread/FarPoint.Web.Spread.IconSetConditionalFormattingRule.IconRuleSet.html) property.
![Icon set rule](https://cdn.mescius.io/document-site-files/images/346c9178-0ed8-4fb9-908b-1565b22fb408/artwork/iconset.png)

## Using Code

Set the properties of the [IconSetConditionalFormattingRule](/spreadnet/api/latest/online-asp/FarPoint.Web.Spread/FarPoint.Web.Spread.IconSetConditionalFormattingRule.html) class and then apply the formatting.

## Example

This example code creates an icon set rule and uses the [SetConditionalFormatting](/spreadnet/api/latest/online-asp/FarPoint.Web.Spread/FarPoint.Web.Spread.SheetView.SetConditionalFormatting.html) method to apply the rule.

```csharp
protected void Page_Load(object sender, System.EventArgs e)
 {
FpSpread1.Sheets[0].RowCount = 5;
FpSpread1.Sheets[0].Cells[0, 0].Value = 8;
FpSpread1.Sheets[0].Cells[1, 0].Value = 5;
FpSpread1.Sheets[0].Cells[2, 0].Value = 10;
FpSpread1.Sheets[0].Cells[3, 0].Value = 1;
 }
protected void Button1_Click(object sender, EventArgs e)
{
FarPoint.Web.Spread.Model.CellRange celRange1 = new FarPoint.Web.Spread.Model.CellRange(0, 0, 4, 1);
FarPoint.Web.Spread.IconSetConditionalFormattingRule rule = new FarPoint.Web.Spread.IconSetConditionalFormattingRule(FarPoint.Web.Spread.ConditionalFormattingIconSetStyle.ThreeRimmedTrafficLights);
FpSpread1.Sheets[0].SetConditionalFormatting(new FarPoint.Web.Spread.Model.CellRange[] { celRange1 }, rule);
}
```

```vbnet
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
FpSpread1.Sheets(0).RowCount = 5
FpSpread1.Sheets(0).Cells(0, 0).Value = 8
FpSpread1.Sheets(0).Cells(1, 0).Value = 5
FpSpread1.Sheets(0).Cells(2, 0).Value = 10
FpSpread1.Sheets(0).Cells(3, 0).Value = 1
End Sub
Protected Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim celRange1 As New FarPoint.Web.Spread.Model.CellRange(0, 0, 4, 1)
Dim rule As New FarPoint.Web.Spread.IconSetConditionalFormattingRule(FarPoint.Web.Spread.ConditionalFormattingIconSetStyle.ThreeRimmedTrafficLights)
FpSpread1.Sheets(0).SetConditionalFormatting(New FarPoint.Web.Spread.Model.CellRange() {celRange1}, rule)
End Sub
```

## Using the Spread Designer

1. In the work area, select the cell or cells for which you want to set the conditional format.
2. Under the **Home** menu, select the **Conditional Formatting** icon in the **Style** section, then select the **Icon Sets** option, and then choose the icon set.
3. From the **File** menu choose **Apply and Exit** to apply your changes to the component and exit Spread Designer.

## See Also

[ConditionalFormattingIcon Enumeration](/spreadnet/api/latest/online-asp/FarPoint.Web.Spread/FarPoint.Web.Spread.ConditionalFormattingIcon.html)
[ConditionalFormattingIconSetStyle Enumeration](/spreadnet/api/latest/online-asp/FarPoint.Web.Spread/FarPoint.Web.Spread.ConditionalFormattingIconSetStyle.html)
[IconSetConditionalFormattingRule Class](/spreadnet/api/latest/online-asp/FarPoint.Web.Spread/FarPoint.Web.Spread.IconSetConditionalFormattingRule.html)