# IFormattedText.Selection Property

> Gets or sets the current selection. The property value is an object of the type Web.Selection. For more information see the description of the Web.Selection class.

- **Product:** TX Text Control .NET Server
- **Section:** Reference
- **Kind:** Property
- **Introduced:** 22.0
- **Namespace:** `TXTextControl.Web`
- **Package:** `TXTextControl.Web` (assembly `TXTextControl.Web.DocumentEditor.dll`, from nuget.org, the private NuGet feed or Text Control Offline Packages)
- **Path:** TX Text Control .NET Server > Reference > TXTextControl.Web > IFormattedText.Selection Property
- **424 words**
- **Web URL:** https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol-web/iformattedtext/selection-property/
- **LLMs URL:** https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol-web/iformattedtext/selection-property/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol-web/iformattedtext/selection-property/llms-full.txt

---

### Description

Gets or sets the current selection. The property value is an object of the type [Web.Selection](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol-web/selection/llms-full.txt). For more information see the description of the [Web.Selection](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol-web/selection/llms-full.txt) class.

### Syntax

```csharp
Selection Selection { get; set; }
```

```vbnet
Property Selection As Selection
```

### Examples

The following example configures `IFormattedText.Selection` and checks the resulting web document component setting before it is used.

```csharp
iFormattedText.Selection = new TXTextControl.Web.Selection();
if (iFormattedText.Selection != null)
{
    Console.WriteLine("Selection is available for IFormatted Text.");
}
```

```vbnet
iFormattedText.Selection = New TXTextControl.Web.Selection()
If iFormattedText.Selection IsNot Nothing Then
    Console.WriteLine("Selection is available for IFormatted Text.")
End If
```

---

## Nearby

- **Previous:** [IFormattedText Class](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol-web/iformattedtext/llms-full.txt)
- **Next:** [MainText Class](https://docs.textcontrol.com/tx-text-control-dotnet-server/reference/txtextcontrol-web/maintext/llms-full.txt)
