# Instruction Constructor

> Initializes a new instance of the Instruction class to determine an action that is executed when the defined requirements of the ConditionalInstruction.Conditions array are fulfilled or not fulfilled.

- **Product:** TX Text Control .NET for Windows Forms
- **Section:** Reference
- **Kind:** Constructor
- **Introduced:** 28.0
- **Namespace:** `TXTextControl`
- **Package:** `TXTextControl.TextControl.WinForms.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 for Windows Forms > Reference > TXTextControl > Instruction Constructor
- **2188 words**
- **Web URL:** https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/instruction/constructor/
- **LLMs URL:** https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/instruction/constructor/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/instruction/constructor/llms-full.txt

---

### Description

Initializes a new instance of the Instruction class to determine an action that is executed when the defined requirements of the [ConditionalInstruction.Conditions](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/conditionalinstruction/conditions-property/llms-full.txt) array are fulfilled or not fulfilled.

### Syntax

#### Instruction(FormField, Instruction.InstructionTypes, object)

Initializes a new instance of the Instruction class to determine the executing action when the defined requirements of the [ConditionalInstruction.Conditions](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/conditionalinstruction/conditions-property/llms-full.txt) array are fulfilled. Using this overload, by default, no else instruction is applied when the corresponding conditions are not fulfilled. Accordingly, the [Instruction.IsElseInstructionEnabled](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/instruction/iselseinstructionenabled-property/llms-full.txt) property is set to false and the [Instruction.ElseInstructionValue](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/instruction/elseinstructionvalue-property/llms-full.txt) property value returns the instruction type depending default value.

```csharp
public Instruction(FormField formField, Instruction.InstructionTypes instructionType, object instructionValue);
```

```vbnet
Public Sub New(formField As FormField, instructionType As Instruction.InstructionTypes, instructionValue As Object)
```

| Parameter | Description |
|---|---|
| formField | Specifies the [form field](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/instruction/formfield-property/llms-full.txt) to which the specified action is executed. |
| instructionType | Specifies the [type](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/instruction/instructiontype-property/llms-full.txt) of the action to perfom. |
| instructionValue | Specifies the desired [value](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/instruction/instructionvalue-property/llms-full.txt) that is set by the specified action when the defined requirements of the <code>ConditionalInstruction.Conditions</code> array are fulfilled.  The type of the <code>instructionValue</code> parameter depends on the [Instruction.InstructionTypes](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/instruction/instructiontypes-enumeration/llms-full.txt) enumeration value that is specified by the <code>instructionType</code> parameter and, in case <code>Instruction.InstructionTypes.SetValue</code> is set, the related form field type:  \| instructionType parameter value \| instructionValue parameter type \| \| IsEnabled \| Boolean \| \| IsValueValid \| Boolean \| \| SetValue (CheckFormField) \| Boolean \| \| SetValue (TextFormField) \| String (null or String.Empty to remove content) \| \| SetValue (SelectionFormField) \| String (null or String.Empty to remove content) \| \| SetValue (DateFormField) \| System.DateTime (null to remove content) \| \| SetItems (only SelectionFormField) \| String\[\] (null or String\[0\] to remove items) \| |
|---|

#### Instruction(FormField, Instruction.InstructionTypes, object, object)

Initializes a new instance of the Instruction class to determine the executing actions when the defined requirements of the [ConditionalInstruction.Conditions](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/conditionalinstruction/conditions-property/llms-full.txt) array are fulfilled or not fulfilled. Apart from the `instructionValue` parameter value, that is set by the specified action when the defined requirements of the `ConditionalInstruction.Conditions` array are fulfilled, an else instruction value must be specified. It is set if the corresponding condtitions are not fulfilled. On using this overload, the [Instruction.IsElseInstructionEnabled](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/instruction/iselseinstructionenabled-property/llms-full.txt) property is set to true and the [Instruction.ElseInstructionValue](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/instruction/elseinstructionvalue-property/llms-full.txt) property represents the set else instruction value.

```csharp
public Instruction(FormField formField, Instruction.InstructionTypes instructionType, object instructionValue, object elseInstructionValue);
```

```vbnet
Public Sub New(formField As FormField, instructionType As Instruction.InstructionTypes, instructionValue As Object, elseInstructionValue As Object)
```

| Parameter | Description |
|---|---|
| formField | Specifies the [form field](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/instruction/formfield-property/llms-full.txt) to which the specified action is executed. |
| instructionType | Specifies the [type](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/instruction/instructiontype-property/llms-full.txt) of the action to perfom. |
| instructionValue | Specifies the desired [value](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/instruction/instructionvalue-property/llms-full.txt) that is set by the specified action when the defined requirements of the <code>ConditionalInstruction.Conditions</code> array are fulfilled.  The type of the <code>instructionValue</code> parameter depends on the [Instruction.InstructionTypes](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/instruction/instructiontypes-enumeration/llms-full.txt) enumeration value that is specified by the <code>instructionType</code> parameter and, in case <code>Instruction.InstructionTypes.SetValue</code> is set, the related form field type:  \| instructionType parameter value \| instructionValue parameter type \| \| IsEnabled \| Boolean \| \| IsValueValid \| Boolean \| \| SetValue (CheckFormField) \| Boolean \| \| SetValue (TextFormField) \| String (null or String.Empty to remove content) \| \| SetValue (SelectionFormField) \| String (null or String.Empty to remove content) \| \| SetValue (DateFormField) \| System.DateTime (null to remove content) \| \| SetItems (only SelectionFormField) \| String\[\] (null or String\[0\] to remove items) \| |
|---|

| elseInstructionValue | Specifies the desired [value](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/instruction/elseinstructionvalue-property/llms-full.txt) that is set by the specified action when the defined requirements of the <code>ConditionalInstruction.Conditions</code> array are not fulfilled.  The type of the <code>elseInstructionValue</code> parameter depends on the <code>Instruction.InstructionTypes</code> enumeration value that is specified by the <code>instructionType</code> parameter and, in case <code>Instruction.InstructionTypes.SetValue</code> is set, the related form field type: |
|---|---|

| instructionType parameter value | instructionValue parameter type |
| IsEnabled | Boolean |
| IsValueValid | Boolean |
| SetValue (CheckFormField) | Boolean |
| SetValue (TextFormField) | String (null or String.Empty to remove content) |
| SetValue (SelectionFormField) | String (null or String.Empty to remove content) |
| SetValue (DateFormField) | System.DateTime (null to remove content) |
| SetItems (only SelectionFormField) | String\[\] (null or String\[0\] to remove items) |

### Examples

The following example creates an Instruction instance and configures its is else instruction enabled setting for a document workflow.

```csharp
Instruction instruction = new(new TXTextControl.CheckFormField(true), Instruction.InstructionTypes.IsEnabled, "Approved");
instruction.IsElseInstructionEnabled = true;
```

```vbnet
Dim instruction As New Instruction(New TXTextControl.CheckFormField(True), Instruction.InstructionTypes.IsEnabled, "Approved")
instruction.IsElseInstructionEnabled = True
```

---

## Nearby

- **Previous:** [Instruction Class](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/instruction/llms-full.txt)
- **Next:** [Instruction.ElseInstructionValue Property](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/instruction/elseinstructionvalue-property/llms-full.txt)
