# EditableRegionCollection.Add Method

> Adds a new editable region to the document. Its position is defined through the EditableRegion.Start and EditableRegion.Length properties. If the editable region's length is zero, the current text selection is used to define the position.

- **Product:** TX Text Control .NET for WPF
- **Section:** Reference
- **Kind:** Method
- **Introduced:** 25.0
- **Namespace:** `TXTextControl`
- **Package:** `TXTextControl.TextControl.WPF.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 WPF > Reference > TXTextControl > EditableRegionCollection.Add Method
- **683 words**
- **Web URL:** https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/editableregioncollection/add-method/
- **LLMs URL:** https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/editableregioncollection/add-method/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/editableregioncollection/add-method/llms-full.txt

---

### Description

Adds a new editable region to the document. Its position is defined through the [EditableRegion.Start](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/editableregion/start-property/llms-full.txt) and [EditableRegion.Length](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/editableregion/length-property/llms-full.txt) properties. If the editable region's length is zero, the current text selection is used to define the position.

### Syntax

```csharp
public EditableRegionCollection.AddResult Add(EditableRegion editableRegion);
```

```vbnet
Public Function Add(editableRegion As EditableRegion) As EditableRegionCollection.AddResult
```

### Parameters

| Parameter | Description |
|---|---|
| editableRegion | Specifies the editable region to add. |

### Return Value

The return value specifies whether the new region has successfully been inserted. It can be one of the [EditableRegionCollection.AddResult](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/editableregioncollection/addresult-enumeration/llms-full.txt) values.

### Examples

The following example works with editable regions in the current document by using `EditableRegionCollection.Add`.

```csharp
textControl.Text = "Customer: Contoso Ltd.";
textControl.Select(10, 12);
EditableRegionCollection editableRegionCollection = textControl.EditableRegions;

var result = editableRegionCollection.Add(new EditableRegion("Editor", 100));
Console.WriteLine($"Add result: {result}");
```

```vbnet
textControl.Text = "Customer: Contoso Ltd."
textControl.Select(10, 12)
Dim editableRegionCollection As EditableRegionCollection = textControl.EditableRegions

Dim result = editableRegionCollection.Add(New EditableRegion("Editor", 100))
Console.WriteLine($"Add result: {result}")
```

---

## Nearby

- **Previous:** [EditableRegionCollection Class](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/editableregioncollection/llms-full.txt)
- **Next:** [EditableRegionCollection.AddResult Enumeration](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/editableregioncollection/addresult-enumeration/llms-full.txt)
