# Enabling and Disabling Commands

C1Editor for WinForms control allows you to easily enable or disable different commands available in the ToolStripMain class.

## Content



Many of the commands described above may or may not be available depending on whether a document is currently loaded, the selection state, or the clipboard content. If a command is not available, it should be disabled in the tool strip.

The **ToolStripMain** class handles this by overriding the **UpdateState** method as follows:

DOC-DETAILS-TAG-OPEN

DOC-SUMMARY-TAG-OPEN

To write code in C#

DOC-SUMMARY-TAG-CLOSE

```csharp
public override void UpdateState()
{
    Enabled = Editor != null;
    _btnCopy.Enabled = _btnCut.Enabled = Editor.CanCopy;
    _btnPaste.Enabled = Editor.CanPasteAsText; // CanPaste
    _btnUndo.Enabled = Editor.CanUndo();
    _btnRedo.Enabled = Editor.CanRedo();
    _btnSpell.Enabled = _btnShowErrors.Enabled = SpellChecker != null;
}
```

DOC-DETAILS-TAG-CLOSE

The implementation is self-explanatory. The [C1Editor](/componentone/api/win/online-richtexteditor/dotnet-framework-api/C1.Win.C1Editor.4.8/C1.Win.C1Editor.C1Editor.html) provides properties and methods that allow the toolstrip to update itself very easily.