# 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. Objects of that class can be added to an instance of the ConditionalInstructionCollection class. The TextControl validates the conditions and executes resulting instructions in case the document switches into the form protection mode and in case the related form fields have been changed. In order to switch the document into the form protection mode, the TextControl.EditMode property must be set to EditMode.ReadAndSelect and the TextControl.DocumentPermissions.ReadOnly property must be set to true. To execute Conditional Instructions in this context, the TextControl.IsFormFieldValidationEnabled property value must to be set to true.

- **Product:** TX Text Control .NET Server
- **Section:** Reference
- **Kind:** Class
- **Introduced:** 28.0
- **Namespace:** `TXTextControl`
- **Package:** `TXTextControl.TextControl.Core.SDK` (assembly `TXTextControl.Core.dll`, from the private NuGet feed or Text Control Offline Packages)
- **Package:** `TXTextControl.TextControl.ASP.SDK` (assembly `TXTextControl.dll`, from the private NuGet feed or Text Control Offline Packages)
- **.NET Framework:** reference `TXTextControl.dll` from the setup
- **Path:** TX Text Control .NET Server > Reference > TXTextControl > ConditionalInstruction Class
- **1079 words**
- **Web URL:** https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol/conditionalinstruction/
- **LLMs URL:** https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol/conditionalinstruction/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol/conditionalinstruction/llms-full.txt

---

### Description

An object of the ConditionalInstruction class represents a list of [form field](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol/formfield/llms-full.txt) related [instructions](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol/conditionalinstruction/instructions-property/llms-full.txt) that are executed when specific requirements, represented by an [array of conditions](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol/conditionalinstruction/conditions-property/llms-full.txt), are fulfilled. Objects of that class can be added to an instance of the [ConditionalInstructionCollection](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol/conditionalinstructioncollection/llms-full.txt) class. The [TextControl](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/llms-full.txt) validates the conditions and executes resulting instructions in case the document switches into the form protection mode and in case the related [form fields](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol/condition/formfield-property/llms-full.txt) have been [changed](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol/documentpermissions/alloweditingformfields-property/llms-full.txt). In order to switch the document into the form protection mode, the [TextControl.EditMode](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol-web/textcontrol/editmode-property/llms-full.txt) property must be set to `EditMode.ReadAndSelect` and the [TextControl.DocumentPermissions.ReadOnly](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol/documentpermissions/readonly-property/llms-full.txt) property must be set to true. To execute `Conditional Instructions` in this context, the [TextControl.IsFormFieldValidationEnabled](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/isformfieldvalidationenabled-property/llms-full.txt) property value must to be set to true.

### Syntax

```csharp
public class ConditionalInstruction
```

```vbnet
Public Class ConditionalInstruction
```

### Examples

The following example builds a rule around an approval check box in a fillable form.

```csharp
CheckFormField approvalField = new(false) { Name = "Approved" };
textControl.FormFields.Add(approvalField);
ConditionalInstruction conditionalInstruction = new();
```

```vbnet
Dim approvalField As New CheckFormField(False) With { .Name = "Approved" }
textControl.FormFields.Add(approvalField)
Dim conditionalInstruction As New ConditionalInstruction()
```

---

## In This Section

- [ConditionalInstruction.Conditions Property](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol/conditionalinstruction/conditions-property/llms-full.txt): Gets or sets an array of conditions, that represent the requirements that has to be fulfilled to execute the specified instructions. Each element of that array is linked by a logical connective connector with its previous element. Based on these relationships, in which the individual conditions relate to each other, it is evaluated whether the requirements to execute the instructions has been fulfilled.
- [ConditionalInstruction Constructor](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol/conditionalinstruction/constructor/llms-full.txt): Initializes a new instance of the ConditionalInstruction class.
- [ConditionalInstruction.Copy Method](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol/conditionalinstruction/copy-method/llms-full.txt): Returns a copy of this ConditionalInstruction object.
- [ConditionalInstruction.Instructions Property](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol/conditionalinstruction/instructions-property/llms-full.txt): Gets or sets an array of instructions that are executed when the specified conditions are fulfilled.
- [ConditionalInstruction.Name Property](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol/conditionalinstruction/name-property/llms-full.txt): Gets or sets a name of the conditional instruction.

---

## Nearby

- **Previous:** [Condition.TextComparisonFlags Enumeration](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol/condition/textcomparisonflags-enumeration/llms-full.txt)
- **Next:** [ConditionalInstruction.Conditions Property](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol/conditionalinstruction/conditions-property/llms-full.txt)
