# DocumentTargetCollection.GetItems Method

> Gets all document targets at the current text input position. The method returns null, if there is no target at the current input position.

- **Product:** TX Text Control .NET for WPF
- **Section:** Reference
- **Kind:** Method
- **Introduced:** 28.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 > DocumentTargetCollection.GetItems Method
- **647 words**
- **Web URL:** https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/documenttargetcollection/getitems-method/
- **LLMs URL:** https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/documenttargetcollection/getitems-method/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/documenttargetcollection/getitems-method/llms-full.txt

---

### Description

Gets all document targets at the current text input position. The method returns null, if there is no target at the current input position.

### Syntax

```csharp
public DocumentTarget[] GetItems();
```

```vbnet
Public Function GetItems() As DocumentTarget()
```

### Return Value

The return value is null, if there is no target at the current input position. Otherwise, it is an array of objects of the type [DocumentTarget](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/documenttarget/llms-full.txt).

### Examples

The following example works with document targets in the current document by using `DocumentTargetCollection.GetItems`.

```csharp
textControl.Text = "Customer: Contoso Ltd.";
textControl.Select(10, 12);
DocumentTargetCollection documentTargetCollection = textControl.DocumentTargets;
documentTargetCollection.Add(new DocumentTarget("CustomerDetails") { ID = 100 });

DocumentTarget[] results = documentTargetCollection.GetItems();
foreach (DocumentTarget documentTarget in results)
{
    Console.WriteLine(documentTarget);
}
```

```vbnet
textControl.Text = "Customer: Contoso Ltd."
textControl.Select(10, 12)
Dim documentTargetCollection As DocumentTargetCollection = textControl.DocumentTargets
documentTargetCollection.Add(New DocumentTarget("CustomerDetails") With { .ID = 100 })

Dim results As DocumentTarget() = documentTargetCollection.GetItems()
For Each documentTarget As DocumentTarget In results
    Console.WriteLine(documentTarget)
Next
```

---

## Nearby

- **Previous:** [DocumentTargetCollection.GetItem Method](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/documenttargetcollection/getitem-method/llms-full.txt)
- **Next:** [DocumentTargetCollection.IsSynchronized Property](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/documenttargetcollection/issynchronized-property/llms-full.txt)
