# Selection.FormattingStyle Property

> Gets or sets the formatting style of the selected text.

- **Product:** TX Text Control .NET for Windows Forms
- **Section:** Reference
- **Kind:** Property
- **Introduced:** 10.1
- **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.FormattingStyle Property
- **631 words**
- **Web URL:** https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/selection/formattingstyle-property/
- **LLMs URL:** https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/selection/formattingstyle-property/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/selection/formattingstyle-property/llms-full.txt

---

### Description

Gets or sets the formatting style of the selected text.

### Syntax

```csharp
public string FormattingStyle { get; set; }
```

```vbnet
Public Property FormattingStyle As String
```

### Examples

The following example formats the heading of a short document by using `Selection.FormattingStyle`.

```csharp
textControl.Text = "Quarterly results\nRevenue increased by 12%.";
textControl.Select(0, 17);
Selection selection = textControl.Selection;

selection.FormattingStyle = "Heading 1";
if (!string.IsNullOrWhiteSpace(selection.FormattingStyle))
{
    Console.WriteLine($"Formatting Style: {selection.FormattingStyle}");
}
```

```vbnet
textControl.Text = "Quarterly results" & vbCrLf & "Revenue increased by 12%."
textControl.Select(0, 17)
Dim selection As Selection = textControl.Selection

selection.FormattingStyle = "Heading 1"
If Not String.IsNullOrWhiteSpace(selection.FormattingStyle) Then
    Console.WriteLine($"Formatting Style: {selection.FormattingStyle}")
End If
```

### Limitations

Runtime only.

### Remarks

The property returns an empty string when the text selection contains multiple characters with different styles. The [Selection.IsCommonValueSelected](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/selection/iscommonvalueselected-method/llms-full.txt) method can be used to check for mixed attributes.

---

## Nearby

- **Previous:** [Selection.ForeColor Property](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/selection/forecolor-property/llms-full.txt)
- **Next:** [Selection.GrowFont Method](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/selection/growfont-method/llms-full.txt)
