# TextControl.Clear Method

> Clears the selected text or the character right from the current input position from the Text Control. This method works only if the Text Control has the focus.

- **Product:** TX Text Control .NET for Windows Forms
- **Section:** Reference
- **Kind:** Method
- **Namespace:** `TXTextControl`
- **Package:** `TXTextControl.TextControl.WinForms.SDK` (assembly `TXTextControl.Windows.Forms.dll`, from the private NuGet feed or Text Control Offline Packages)
- **.NET Framework:** reference `TXTextControl.Windows.Forms.dll` from the setup
- **Path:** TX Text Control .NET for Windows Forms > Reference > TXTextControl > TextControl.Clear Method
- **290 words**
- **Web URL:** https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/clear-method/
- **LLMs URL:** https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/clear-method/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/clear-method/llms-full.txt

---

### Description

Clears the selected text or the character right from the current input position from the Text Control. This method works only if the Text Control has the focus.

### Syntax

```csharp
public void Clear();
```

```vbnet
Public Sub Clear()
```

### Examples

The following example clears the current document only when it contains content.

```csharp
if (textControl.Text.Length > 0)
{
    textControl.Clear();
}
```

```vbnet
If textControl.Text.Length > 0 Then
    textControl.Clear()
End If
```

---

## Nearby

- **Previous:** [TextControl.ChartSized Event](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/chartsized-event/llms-full.txt)
- **Next:** [TextControl.ClearUndo Method](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/clearundo-method/llms-full.txt)
