# TextControl.ConditionalInstructionDialog Method

> Opens a dialog box to create or edit a Conditional Instruction.

- **Product:** TX Text Control .NET for WPF
- **Section:** Reference
- **Kind:** Method
- **Introduced:** 28.0
- **Namespace:** `TXTextControl.WPF`
- **Package:** `TXTextControl.TextControl.WPF.SDK` (assembly `TXTextControl.WPF.dll`, from the private NuGet feed or Text Control Offline Packages)
- **.NET Framework:** reference `TXTextControl.WPF.dll` from the setup
- **Path:** TX Text Control .NET for WPF > Reference > TXTextControl.WPF > TextControl.ConditionalInstructionDialog Method
- **811 words**
- **Web URL:** https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol-wpf/textcontrol/conditionalinstructiondialog-method/
- **LLMs URL:** https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol-wpf/textcontrol/conditionalinstructiondialog-method/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol-wpf/textcontrol/conditionalinstructiondialog-method/llms-full.txt

---

### Description

Opens a dialog box to create or edit a Conditional Instruction.

### Syntax

#### ConditionalInstructionDialog()

Opens a dialog box to create a new `Conditional Instruction`.

```csharp
public bool? ConditionalInstructionDialog();
```

```vbnet
Public Function ConditionalInstructionDialog() As Boolean?
```

#### ConditionalInstructionDialog(string)

Opens a dialog box to edit a specific `Conditional Instruction`. If the document does not contain a `Conditional Instruction` with the specified name, the dialog is opened to create such a `Conditional Instruction`.

```csharp
public bool? ConditionalInstructionDialog(string name);
```

```vbnet
Public Function ConditionalInstructionDialog(name As String) As Boolean?
```

| Parameter | Description |
|---|---|
| name | Specifies the name of the `Conditional Instruction` to edit or create. |

### Return Value

The return value can be one of the following values:

| Result | Meaning |
|---|---|
| true | The dialog has been left with the `OK` button and the corresponding `Conditional Instruction` was created or edited. |
| false | The dialog has been left with the `Cancel` button. |
| null | The dialog has not been opened. |

### Examples

The following example opens the conditional instruction dialog for the text control.

```csharp
var result = textControl.ConditionalInstructionDialog("CustomerName");
Console.WriteLine($"Conditional Instruction Dialog result: {result}");
```

```vbnet
Dim result = textControl.ConditionalInstructionDialog("CustomerName")
Console.WriteLine($"Conditional Instruction Dialog result: {result}")
```

### Limitations

The dialog cannot be opened, if the document does not contain [form fields](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol-wpf/textcontrol/formfields-property/llms-full.txt), the [TextControl.IsFormFieldValidationEnabled](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol-wpf/textcontrol/isformfieldvalidationenabled-property/llms-full.txt) is set to false or the [EditMode](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol-wpf/textcontrol/editmode-property/llms-full.txt) property is set to `EditMode.ReadAndSelect` and [TextControl.DocumentPermissions.ReadOnly](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/documentpermissions/readonly-property/llms-full.txt) to true. In these cases the method returns null.

---

## Nearby

- **Previous:** [TextControl.CommentStateChanged Event](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol-wpf/textcontrol/commentstatechanged-event/llms-full.txt)
- **Next:** [TextControl Constructor](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol-wpf/textcontrol/constructor/llms-full.txt)
