# Using the Formula Extender Control

Use the formula extender control to calculate values from the Spread control and display the result in other controls such as a text box control.

## Content

You can use the formula extender control to calculate values from the Spread control and display the result in other controls such as a text box control.
The following standard .NET controls are supported with the formula extender control:

* TextBox
* Label
* DropDownList
* CheckBox
* CheckBoxList
* RadioButton
* RadioButtonList
* ListBox
* HiddenField
* HyperLink
* Literal
* Button

The following HTML controls are supported with the formula extender control:

* HtmlInputControl
* HtmlAnchor
* HtmlImage
* HtmlSelect
* HtmlTextArea
* HtmlContainerControl

Valid formula formats include the control name in brackets and the sheet name. For example:

* SUM([FpSpread1]Sheet1!B1:B3)
* 1.1 \* [ttPrice]
* [textBox2].text

The FormulaExtender control is located in the Visual Studio toolbox under the Mescius Spread section as shown in the following image.
![FormulaExtender control](https://cdn.mescius.io/document-site-files/images/346c9178-0ed8-4fb9-908b-1565b22fb408/artwork/formextendweb.png)

## Using the Formula Extender

Use the following steps to use the formula extender control:

1. Add the formula extender control to the form.
2. Add a control to display the calculation result (such as a text box).
3. Select the Formula Entries option by selecting **Edit Formula Entries** from the formula extender verb or by selecting **FormulaEntries** from the formula extender property list.
    ![Edit Formula Entries](https://cdn.mescius.io/document-site-files/images/346c9178-0ed8-4fb9-908b-1565b22fb408/artwork/formextendverb.png)
    ![Select FormulaEntries in Properties pane](https://cdn.mescius.io/document-site-files/images/346c9178-0ed8-4fb9-908b-1565b22fb408/artwork/formextendprop.png)
4. The **FormulaEntry Collection** editor is displayed.
    ![FormulaEntry Collection editor](https://cdn.mescius.io/document-site-files/images/346c9178-0ed8-4fb9-908b-1565b22fb408/artwork/formulaentry1.png)
5. Select the **Add** button and specify the control ID and formula. Then select **OK**.
    ![Adding formula in FormulaEntry Collection editor](https://cdn.mescius.io/document-site-files/images/346c9178-0ed8-4fb9-908b-1565b22fb408/artwork/formulaentry.png)

## Using Code

1. Add a text box control.
2. Use the [AddFormula](/spreadnet/api/latest/online-asp/FarPoint.Web.Spread/FarPoint.Web.Spread.FormulaExtender.AddFormula.html) method.

## Example

The following example adds a cell value to a text box control.

```csharp
FpSpread1.ActiveSheetView.Cells[0, 0].Value = 2;
FpSpread1.ActiveSheetView.Cells[1, 0].Value = 3;
FormulaExtender1.AddFormula("textBox2", "[FpSpread1]Sheet1!A2");
```

```vbnet
FpSpread1.ActiveSheetView.Cells(0, 0).Value = 2
FpSpread1.ActiveSheetView.Cells(1, 0).Value = 3
FormulaExtender1.AddFormula("textBox2", "[FpSpread1]Sheet1!A2")
```

## See Also

[Managing Formulas](/spreadnet/docs/latest/online-asp/overview/spweb-devguide/spweb-formulas)
[RemoveFormula Method](/spreadnet/api/latest/online-asp/FarPoint.Web.Spread/FarPoint.Web.Spread.FormulaExtender.RemoveFormula.html)