In This Topic

Setting up the Formula Provider

In This Topic

You can add a formula provider control to the form. The provider control can be added to the **Toolbox**. Find the formula provider control in the list of .NET controls that can be added to the **Toolbox** and select it.

Double-click the formula provider control after selecting it from the **Toolbox**.

Two design properties will be added to each control on the form. The **Formula on Formula Provider** property is the property for setting a formula. The **Formula Trigger Event on Formula Provider** property allows you to determine which event will cause the formula to update.

The following basic example shows how to use the formula provider at design time. This example uses two text box controls and the formula provider. The second text box displays the value from the first text box. The formula for the second text box (**Formula on Formula Provider** property) has been set to be equal to the first text box. The trigger event (**FormulaTriggerEvent**) has been set to the **TextChanged** event.

For more information on formulas, refer to Managing Formulas in Cells and the Formula Reference.

Add the formula provider and two text box controls to the form and set the SetFormula and TextChanged Event methods for the formula provider.

This example gets the typed data from text box 1 and puts it in text box 2.

C# |
Copy Code |
---|---|

FormulaProvider1.SetFormula(TextBox2, "=TextBox1"); FormulaProvider1.SetFormulaTriggerEvent(TextBox1, "TextChanged"); |

VB |
Copy Code |
---|---|

FormulaProvider1.SetFormula(TextBox2, "=TextBox1") FormulaProvider1.SetFormulaTriggerEvent(TextBox1, "TextChanged") |

See Also