# Editing Text

> Select, copy, undo, find and drag text in a Windows Forms TextControl: built-in keys and ribbon commands, and the C# API for your own menus and shortcuts.

- **Product:** TX Text Control .NET for Windows Forms
- **Section:** Documentation
- **Kind:** Topic
- **Path:** TX Text Control .NET for Windows Forms > Document Editor > Editing Text
- **899 words**
- **Web URL:** https://docs.textcontrol.com/tx-text-control-dotnet-winforms/document-editor/editing-text/
- **LLMs URL:** https://docs.textcontrol.com/tx-text-control-dotnet-winforms/document-editor/editing-text/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-text-control-dotnet-winforms/document-editor/editing-text/llms-full.txt

---

Selecting, copying, undoing, finding and moving text are the everyday work of a word processor, and `TextControl` handles them for your users out of the box. The pages that follow cover what your Windows Forms application adds: reading and setting the selection and the caret, clipboard and undo commands in your own menus, searching and replacing in code, accepting dropped files and assigning keys.

### How Editing Works in TextControl

- **Built in.** Typing, selecting with the mouse and the keyboard, the clipboard keys, undo and redo, and dragging selected text work as soon as the editor has the focus. No code is needed.
- **In the ribbon.** With the ribbon of [Create Your First Windows Forms Application](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/getting-started/document-editor/first-application/llms-full.txt), the **Home** tab adds the **Clipboard** group and the **Editing** group with **Find...**, **Replace...**, **Go to...** and **Select All**.
- **In code.** The commands of the user have counterparts in the API: `Select` and the `Selection` property, `Copy`, `Paste`, `Undo`, `Find` and more. Your code uses them for its own commands and to change documents at a known place.

Two terms run through all pages of this section. The *input position* is where typed text appears, marked by the caret. The *selection* is the highlighted range that the next command acts on. Both are counted in text positions, which start with 0 in front of the first character.

### Find the Right Page

| If you want to | Read |
|---|---|
| Select, read or replace text in code, or find out where the caret is | [Selections and Caret Position](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/document-editor/editing-text/selections/llms-full.txt) |
| Add Cut, Copy and Paste commands, or paste only plain text | [Clipboard Operations](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/document-editor/editing-text/clipboard/llms-full.txt) |
| Show undo and redo in a menu, or undo several changes in one step | [Undo and Redo](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/document-editor/editing-text/undo-redo/llms-full.txt) |
| Open the Find and Replace dialog boxes, or replace text in code | [Search and Replace](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/document-editor/editing-text/search-replace/llms-full.txt) |
| Accept files dragged from File Explorer | [Drag and Drop](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/document-editor/editing-text/drag-drop/llms-full.txt) |
| Look up a key, or add shortcuts such as Ctrl+F | [Keyboard Shortcuts](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/document-editor/editing-text/keyboard-shortcuts/llms-full.txt) |

### Where to Start

1. Read [Selections and Caret Position](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/document-editor/editing-text/selections/llms-full.txt) first. The other pages select text and use text positions.
2. Continue with the page of the command you want to add.
3. Before you add a shortcut, check [Keyboard Shortcuts](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/document-editor/editing-text/keyboard-shortcuts/llms-full.txt) for the keys the editor already uses.

### Pages in This Section

- [Selections and Caret Position](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/document-editor/editing-text/selections/llms-full.txt): text positions, `Select`, `Selection`, `InputPosition` and the mouse actions.
- [Clipboard Operations](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/document-editor/editing-text/clipboard/llms-full.txt): `Copy`, `Cut`, `Paste`, clipboard formats and document permissions.
- [Undo and Redo](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/document-editor/editing-text/undo-redo/llms-full.txt): undo commands, action names, grouped steps and the undo buffer.
- [Search and Replace](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/document-editor/editing-text/search-replace/llms-full.txt): the Find and Replace dialog boxes and sidebars, `Find` and replacing in all text parts.
- [Drag and Drop](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/document-editor/editing-text/drag-drop/llms-full.txt): moving text with the mouse, drop formats and dropped files.
- [Keyboard Shortcuts](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/document-editor/editing-text/keyboard-shortcuts/llms-full.txt): all built-in keys and your own shortcuts in `KeyDown`.

Formatting the selected text is the subject of [Text and Paragraph Formatting](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/document-editor/formatting/llms-full.txt). To change documents without showing them, use [Document Processing](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/document-processing/llms-full.txt).

---

## In This Section

- [Clipboard Operations](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/document-editor/editing-text/clipboard/llms-full.txt): Add Cut, Copy and Paste to a Windows Forms menu with CanCopy, CanPaste and GetClipboardFormats, paste plain text only and load RTF with its page size.
- [Drag and Drop](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/document-editor/editing-text/drag-drop/llms-full.txt): Move text with the mouse, set AllowDrag, AllowDrop and DropFormats, and insert documents and images dropped from File Explorer in a Windows Forms TextControl.
- [Keyboard Shortcuts](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/document-editor/editing-text/keyboard-shortcuts/llms-full.txt): All built-in keys of the Windows Forms TextControl, a KeyDown handler for Ctrl+F, Ctrl+H and Insert, and a KeyPress handler that turns Enter into a line break.
- [Search and Replace](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/document-editor/editing-text/search-replace/llms-full.txt): Open the Find and Replace dialog boxes and sidebars of a Windows Forms TextControl, call Find with FindOptions and replace all matches in one undo step.
- [Selections and Caret Position](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/document-editor/editing-text/selections/llms-full.txt): Select and replace text in a Windows Forms TextControl with Selection and InputPosition, track the caret and find the line and character under the mouse.
- [Undo and Redo](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/document-editor/editing-text/undo-redo/llms-full.txt): Build Undo and Redo menu items with UndoActionName in Windows Forms, group changes with BeginUndoAction, clear the buffer after Load and turn off AllowUndo.

---

## Nearby

- **Previous:** [Document Properties](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/document-editor/properties/llms-full.txt)
- **Next:** [Selections and Caret Position](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/document-editor/editing-text/selections/llms-full.txt)
