# MainText.Charts Property

> Gets a collection of all charts contained in the main text of the document. The property value is an object of the type DataVisualization.ChartCollection. The collection can be used to get or to alter a chart's attributes and to add charts to or to remove charts.

- **Product:** TX Text Control .NET for Windows Forms
- **Section:** Reference
- **Kind:** Property
- **Introduced:** 23.0
- **Namespace:** `TXTextControl`
- **Package:** `TXTextControl.TextControl.WinForms.SDK` (assembly `TXTextControl.dll`, from the private NuGet feed or Text Control Offline Packages)
- **.NET Framework:** reference `TXTextControl.dll` from the setup
- **Inherited from:** `TXTextControl.TextPartBase`
- **Path:** TX Text Control .NET for Windows Forms > Reference > TXTextControl > MainText.Charts Property
- **518 words**
- **Web URL:** https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/maintext/charts-property/
- **LLMs URL:** https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/maintext/charts-property/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/maintext/charts-property/llms-full.txt

---

### Description

Gets a collection of all charts contained in the main text of the document. The property value is an object of the type [DataVisualization.ChartCollection](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol-datavisualization/chartcollection/llms-full.txt). The collection can be used to get or to alter a chart's attributes and to add charts to or to remove charts.

### Syntax

```csharp
public ChartCollection Charts { get; }
```

```vbnet
Public ReadOnly Property Charts As ChartCollection
```

### Examples

The following example applies bold formatting through the main text's selection by using `MainText.Charts`.

```csharp
Selection formattedSelection = mainText.Selection;
formattedSelection.Bold = true;
mainText.Selection = formattedSelection;

foreach (TXTextControl.DataVisualization.ChartFrame chartFrame in mainText.Charts)
{
    chartFrame.DescriptiveText = "Quarterly results";
}
```

```vbnet
Dim formattedSelection As Selection = mainText.Selection
formattedSelection.Bold = True
mainText.Selection = formattedSelection

For Each chartFrame As TXTextControl.DataVisualization.ChartFrame In mainText.Charts
    chartFrame.DescriptiveText = "Quarterly results"
Next
```

### Limitations

Read only.

---

## Nearby

- **Previous:** [MainText Class](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/maintext/llms-full.txt)
- **Next:** [MainText.TextFrames Property](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/maintext/textframes-property/llms-full.txt)
