# ChartCollection.GetItem Method

> Gets a particular chart from the collection.

- **Product:** TX Text Control .NET for WPF
- **Section:** Reference
- **Kind:** Method
- **Introduced:** 18.0
- **Namespace:** `TXTextControl.DataVisualization`
- **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.DataVisualization > ChartCollection.GetItem Method
- **742 words**
- **Web URL:** https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol-datavisualization/chartcollection/getitem-method/
- **LLMs URL:** https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol-datavisualization/chartcollection/getitem-method/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol-datavisualization/chartcollection/getitem-method/llms-full.txt

---

### Description

Gets a particular chart from the collection.

### Syntax

#### GetItem()

Gets the chart selected by the user.

```csharp
public ChartFrame GetItem();
```

```vbnet
Public Function GetItem() As ChartFrame
```

#### GetItem(int)

Gets the chart with the specified identifier. An id can be set with the [ID](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/framebase/id-property/llms-full.txt) property.

```csharp
public ChartFrame GetItem(int id);
```

```vbnet
Public Function GetItem(id As Integer) As ChartFrame
```

| Parameter | Description |
|---|---|
| id | Specifies the chart's identifier. The method returns null if a chart with the specified identifier does not exist. |

#### GetItem(string)

Gets the chart with the specified name. A name can be set with the [Name](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/framebase/name-property/llms-full.txt) property.

```csharp
public ChartFrame GetItem(string name);
```

```vbnet
Public Function GetItem(name As String) As ChartFrame
```

| Parameter | Description |
|---|---|
| name | Specifies the chart's name. The method returns null if a chart with the specified name does not exist. |

### Return Value

The return value is null, if a chart with the specified parameters could not be found. Otherwise, it is an object of the type [DataVisualization.ChartFrame](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol-datavisualization/chartframe/llms-full.txt).

### Examples

The following example retrieves item from the chart collection.

```csharp
var result = chartCollection.GetItem(100);
Console.WriteLine($"Get Item result: {result}");
```

```vbnet
Dim result = chartCollection.GetItem(100)
Console.WriteLine($"Get Item result: {result}")
```

---

## Nearby

- **Previous:** [ChartCollection.CopyTo Method](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol-datavisualization/chartcollection/copyto-method/llms-full.txt)
- **Next:** [ChartCollection.Remove Method](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol-datavisualization/chartcollection/remove-method/llms-full.txt)
