How to: Insert Text at the Cursor Position
The following code snippet demonstrates how you can insert text at the cursor position in the RichEditControl document:
Note
A complete sample project is available at https://github.com/DevExpress-Examples/winforms-richedit-document-api-e5219
DocumentPosition pos = document.CaretPosition;
SubDocument doc = pos.BeginUpdateDocument();
doc.InsertText(pos, " INSERTED TEXT ");
pos.EndUpdateDocument(doc);
Tip
You can insert text at the cursor position within the text box. Use the TextBox.Document property to obtain the text box content. Refer to the How to: Insert Rich Text in the TextBox topic for details.