# Selection.ChangeCapitalization Method

> Changes the capitalization of all selected characters depending on the settings parameter.

- **Product:** TX Text Control .NET for WPF
- **Section:** Reference
- **Kind:** Method
- **Introduced:** 30.0
- **Namespace:** `TXTextControl`
- **Package:** `TXTextControl.TextControl.WPF.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 WPF > Reference > TXTextControl > Selection.ChangeCapitalization Method
- **750 words**
- **Web URL:** https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/selection/changecapitalization-method/
- **LLMs URL:** https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/selection/changecapitalization-method/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/selection/changecapitalization-method/llms-full.txt

---

### Description

Changes the capitalization of all selected characters depending on the settings parameter.

### Syntax

```csharp
public bool ChangeCapitalization(CapitalizationSettings cs);
```

```vbnet
Public Function ChangeCapitalization(cs As CapitalizationSettings) As Boolean
```

### Parameters

| Parameter | Description |
|---|---|
| cs | Specifies how the capitalization is changed. It can be one of the [CapitalizationSettings](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/capitalizationsettings/enumeration/llms-full.txt) values:  \| Value \| Meaning \| \| CapitalizeEachSentence \| The first letter of each sentence is capitalized. \| \| CapitalizeEachWord \| The first letter of each word is capitalized. \| \| ToLower \| All letters are changed to lowercase. \| \| ToUpper \| All letters are changed to uppercase. \| \| ToggleCase \| Lowercase letters are changed to uppercase and vice versa. \| |
|---|

### Return Value

The return value is false, if there is no selected text or if an error has occurred. Otherwise it is true.

### Examples

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

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

if (selection.ChangeCapitalization(CapitalizationSettings.ToUpper))
{
    Console.WriteLine("Change Capitalization completed successfully.");
}
```

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

If selection.ChangeCapitalization(CapitalizationSettings.ToUpper) Then
    Console.WriteLine("Change Capitalization completed successfully.")
End If
```

---

## Nearby

- **Previous:** [Selection.Capitals Property](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/selection/capitals-property/llms-full.txt)
- **Next:** [Selection.ChangeDirection Method](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol/selection/changedirection-method/llms-full.txt)
