A very unique feature of form fields in TX Text Control is the usage of Conditional Instructions ╰ TX Text Control .NET for Windows Forms
╰ TXTextControl Namespace
╰ ConditionalInstruction Class
An object of the ConditionalInstruction class represents a list of form field related instructions that are executed when specific requirements, represented by an array of conditions, are fulfilled. . It is possible to add dependencies between fields based on logical operators. This allows to add a complete workflow to forms by adding dependencies between form fields.
Combining Instructions and Formulas
The following animated screenshot shows such a condition. If the user changes the selected product in the drop-down form field, the description and the unit price is changing:
The first condition product selection is shown in the next screenshot. If the selected item is Product 1, then the product description, the default quantity and the unit price is set dynamically. The screenshot shows the out-of-the-box dialog that can be used to create these instructions. But they can be also created programmatically in case that data must be added dynamically, for example from data sources.
The next screenshot shows the cell (circled in green) and the corresponding formula (circled in red) to calculate the line total. Essentially, the formula multiplies the quantity with the unit price:
You can see that the line total table cell is a form field. That shows that a form field value can be changed by a formula and formulas can use form field values to calculate the results. On other words: Both elements can be combined.
Another instruction is setting a tax percentage value in case a check box is checked:
The instruction for this action can be seen in the next screenshot:
The formula for this calculation is circled in red. Because the cell value type is percentage, we only need to multiply the total line value with the sales tax value that has been set dynamically using the form field conditions:
Finally, the total amount is calculated by adding up the tax value and the line total:
You can download the demo template for your own tests here: