# LineCollection.GetItem Method

> Gets a particular line from the collection.

- **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 > LineCollection.GetItem Method
- **729 words**
- **Web URL:** https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol/linecollection/getitem-method/
- **LLMs URL:** https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol/linecollection/getitem-method/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol/linecollection/getitem-method/llms-full.txt

---

### Description

Gets a particular line from the collection.

### Syntax

#### GetItem(Point)

Gets the line at a certain geometrical position.

```csharp
public Line GetItem(Point location);
```

```vbnet
Public Function GetItem(location As Point) As Line
```

| Parameter | Description |
|---|---|
| location | Specifies the line's location. The point must be specified in pixels with an origin at the top left corner of the control. |

#### GetItem(int)

Gets the line at a certain text position.

```csharp
public Line GetItem(int textPosition);
```

```vbnet
Public Function GetItem(textPosition As Integer) As Line
```

| Parameter | Description |
|---|---|
| textPosition | Specifies a zero-based text position. |

### Return Value

The return value is null, if a line could not be found. Otherwise, it is an object of the type Line.

### Examples

The following example works with lines in the current document by using `LineCollection.get_Item`.

```csharp
LineCollection lineCollection = textControl.Lines;
textControl.Text = "Quarterly results\nRevenue increased by 12%.";

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

```vbnet
Dim lineCollection As LineCollection = textControl.Lines
textControl.Text = "Quarterly results" & vbCrLf & "Revenue increased by 12%."

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

---

## Nearby

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