# TextControl.CanUndo Property

> Gets a value indicating whether the user can undo the previous operation in a Text Control.

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

---

### Description

Gets a value indicating whether the user can undo the previous operation in a Text Control.

### Syntax

```csharp
public bool CanUndo { get; }
```

```vbnet
Public ReadOnly Property CanUndo As Boolean
```

### Examples

The following XAML example shows how to bind the CanUndo property to the IsEnabled attribute of a menu item.

```plaintext
<MenuItem
   Header="Undo"
   Command="ApplicationCommands.Undo"
   IsEnabled="{Binding ElementName=textControl1, Path=CanUndo}" />
```

The following example checks can undo before performing the related operation.

```csharp
if (textControl.CanUndo)
{
    textControl.Undo();
}
```

```vbnet
If textControl.CanUndo Then
    textControl.Undo()
End If
```

### Limitations

Runtime only.

Read only.

---

## Nearby

- **Previous:** [TextControl.CanTableFormat Property](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/cantableformat-property/llms-full.txt)
- **Next:** [TextControl.CaretWidth Property](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/caretwidth-property/llms-full.txt)
