# Selection Constructor

> Creates a new instance of the Selection class.

- **Product:** TX Text Control .NET for Windows Forms
- **Section:** Reference
- **Kind:** Constructor
- **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 > Selection Constructor
- **705 words**
- **Web URL:** https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/selection/constructor/
- **LLMs URL:** https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/selection/constructor/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/selection/constructor/llms-full.txt

---

### Description

Creates a new instance of the [Selection](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/selection/llms-full.txt) class.

### Syntax

#### Selection()

Creates an empty [Selection](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/selection/llms-full.txt) object with all properties set to their default values.

```csharp
public Selection();
```

```vbnet
Public Sub New()
```

#### Selection(int, int)

Creates an instance of the [Selection](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/selection/llms-full.txt) class with the specified start value and length. All other properties are set to their default values.

```csharp
public Selection(int start, int length);
```

```vbnet
Public Sub New(start As Integer, length As Integer)
```

| Parameter | Description |
|---|---|
| start | Specifies the selection's start position. |
| length | Specifies the number of selected characters. |

### Examples

The following example creates a reusable selection format and applies it to the current report heading.

```csharp
textControl.Text = "Quarterly results";
textControl.Select(0, textControl.Text.Length);
Selection selection = new() { Bold = true, FontSize = 280 };
textControl.Selection = selection;
```

```vbnet
textControl.Text = "Quarterly results"
textControl.Select(0, textControl.Text.Length)
Dim selection As New Selection() With { .Bold = True, .FontSize = 280 }
textControl.Selection = selection
```

---

## Nearby

- **Previous:** [Selection.CharacterSpacing Property](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/selection/characterspacing-property/llms-full.txt)
- **Next:** [Selection.Culture Property](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/selection/culture-property/llms-full.txt)
