# TextCharCollection.GetItem Method

> Gets a particular character from the collection specified through a certain geometrical position.

- **Product:** TX Text Control .NET Server
- **Section:** Reference
- **Kind:** Method
- **Introduced:** 10.1
- **Namespace:** `TXTextControl`
- **Package:** `TXTextControl.TextControl.Core.SDK` (assembly `TXTextControl.Core.dll`, from the private NuGet feed or Text Control Offline Packages)
- **Package:** `TXTextControl.TextControl.ASP.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 Server > Reference > TXTextControl > TextCharCollection.GetItem Method
- **685 words**
- **Web URL:** https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol/textcharcollection/getitem-method/
- **LLMs URL:** https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol/textcharcollection/getitem-method/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol/textcharcollection/getitem-method/llms-full.txt

---

### Description

Gets a particular character from the collection specified through a certain geometrical position.

### Syntax

```csharp
public TextChar GetItem(Point location, bool getNearest);
```

```vbnet
Public Function GetItem(location As Point, getNearest As Boolean) As TextChar
```

### Parameters

| Parameter | Description |
|---|---|
| location | Specifies the character's location. The point must be specified in pixels with an origin at the top left corner of the control. |
| getNearest | Specifies whether the nearest character is returned. If this parameter is set to true, the nearest character is returned. Otherwise, if set to false, a character is only returned, if the specified location is inside the bounding rectangle of an existing character. |

### Return Value

The return value is null, if a character could not be found. Otherwise, it is an object of the type [TextChar](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol/textchar/llms-full.txt).

### Examples

The following example works with text chars in the current document by using `TextCharCollection.get_Item`.

```csharp
TextCharCollection textCharCollection = textControl.TextChars;
textControl.Text = "Quarterly results\nRevenue increased by 12%.";

var result = textCharCollection.GetItem(new System.Drawing.Point(20, 20), true);
Console.WriteLine($"Get Item result: {result}");
```

```vbnet
Dim textCharCollection As TextCharCollection = textControl.TextChars
textControl.Text = "Quarterly results" & vbCrLf & "Revenue increased by 12%."

Dim result = textCharCollection.GetItem(New System.Drawing.Point(20, 20), True)
Console.WriteLine($"Get Item result: {result}")
```

---

## Nearby

- **Previous:** [TextCharCollection.GetEnumerator Method](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol/textcharcollection/getenumerator-method/llms-full.txt)
- **Next:** [TextCharCollection.Item Property](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol/textcharcollection/item-property/llms-full.txt)
