# ConditionalInstructionCollection.Clear Method

> Removes all conditional instructions from the collection and the document.

- **Product:** TX Text Control .NET for Windows Forms
- **Section:** Reference
- **Kind:** Method
- **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 > ConditionalInstructionCollection.Clear Method
- **417 words**
- **Web URL:** https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/conditionalinstructioncollection/clear-method/
- **LLMs URL:** https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/conditionalinstructioncollection/clear-method/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/conditionalinstructioncollection/clear-method/llms-full.txt

---

### Description

Removes all conditional instructions from the collection and the document.

### Syntax

```csharp
public bool Clear();
```

```vbnet
Public Function Clear() As Boolean
```

### Return Value

The return value is true, if all conditional instructions could be removed. Otherwise false. The objects won't be removed, if the [TextControl.IsFormFieldValidationEnabled](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/isformfieldvalidationenabled-property/llms-full.txt) property is set to false or the [TextControl.EditMode](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/editmode-property/llms-full.txt) is set to `EditMode.ReadAndSelect` and [TextControl.DocumentPermissions.ReadOnly](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/documentpermissions/readonly-property/llms-full.txt) to true.

### Examples

The following example removes all conditional instruction objects from the collection and the document.

```csharp
if (conditionalInstructionCollection.Count > 0)
{
    conditionalInstructionCollection.Clear();
}
```

```vbnet
If conditionalInstructionCollection.Count > 0 Then
    conditionalInstructionCollection.Clear()
End If
```

---

## Nearby

- **Previous:** [ConditionalInstructionCollection.Add Method](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/conditionalinstructioncollection/add-method/llms-full.txt)
- **Next:** [ConditionalInstructionCollection.ConditionalInstructionNames Property](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/conditionalinstructioncollection/conditionalinstructionnames-property/llms-full.txt)
