Spread ASP.NET 16
Spread for ASP.NET 16 Product Documentation / Developer's Guide / Customizing User Interaction / Customizing Interaction with the Overall Component / Using the Formula Extender Control
In This Topic
    Using the Formula Extender Control
    In This Topic

    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:

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

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

    The FormulaExtender control is located in the Visual Studio toolbox under the GrapeCity Spread section as shown in the following image.

    FormulaExtender control

    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

      Select FormulaEntries in Properties pane

    4. The FormulaEntry Collection editor is displayed.

      FormulaEntry Collection editor

    5. Select the Add button and specify the control ID and formula. Then select OK.

      Adding formula in FormulaEntry Collection editor

    Using Code

    1. Add a text box control.
    2. Use the AddFormula method.

    Example

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

    C#
    Copy Code
    FpSpread1.ActiveSheetView.Cells[0, 0].Value = 2;
    FpSpread1.ActiveSheetView.Cells[1, 0].Value = 3;
    FormulaExtender1.AddFormula("textBox2", "[FpSpread1]Sheet1!A2");
    
    VB
    Copy Code
    FpSpread1.ActiveSheetView.Cells(0, 0).Value = 2
    FpSpread1.ActiveSheetView.Cells(1, 0).Value = 3
    FormulaExtender1.AddFormula("textBox2", "[FpSpread1]Sheet1!A2")
    
    See Also