# TextPartCollection.GetMainText Method

> Gets the main text part of the document.

- **Product:** TX Text Control .NET for Windows Forms
- **Section:** Reference
- **Kind:** Method
- **Introduced:** 16.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
- **Path:** TX Text Control .NET for Windows Forms > Reference > TXTextControl > TextPartCollection.GetMainText Method
- **350 words**
- **Web URL:** https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textpartcollection/getmaintext-method/
- **LLMs URL:** https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textpartcollection/getmaintext-method/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textpartcollection/getmaintext-method/llms-full.txt

---

### Description

Gets the main text part of the document.

### Syntax

```csharp
public MainText GetMainText();
```

```vbnet
Public Function GetMainText() As MainText
```

### Return Value

The return value is the main text part of the document. It is an object of the type [MainText](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/maintext/llms-full.txt).

### Examples

The following example works with text parts in the current document by using `TextPartCollection.GetMainText`.

```csharp
TextPartCollection textPartCollection = textControl.TextParts;

var result = textPartCollection.GetMainText();
Console.WriteLine($"Get Main Text result: {result}");
```

```vbnet
Dim textPartCollection As TextPartCollection = textControl.TextParts

Dim result = textPartCollection.GetMainText()
Console.WriteLine($"Get Main Text result: {result}")
```

---

## Nearby

- **Previous:** [TextPartCollection.GetItem Method](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textpartcollection/getitem-method/llms-full.txt)
- **Next:** [ThesaurusDialog Class](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/thesaurusdialog/llms-full.txt)
