Help Center

CRichEditCtx.ReplaceSelmethod

Replaces the current selection in a rich edit control with the specified text.

Windowsmethoddocumented

Syntax

SUB ReplaceSel (BYVAL bCanBeUndone AS LONG = TRUE, BYREF wszText AS WSTRING)

Parameters

NameDescription
bCanBeUndoneSpecifies whether the replacement operation can be undone. If this is TRUE, the operation can be undone. If this is FALSE, the operation cannot be undone.
wszTextA WSTRING containing the replacement text.

Description

Replaces the current selection in a rich edit control with the specified text.

Remarks

Use the ReplaceSel method to replace only a portion of the text in an edit control. To replace all of the text, use the Text property.

If there is no selection, the replacement text is inserted at the caret.

In a rich edit control, the replacement text takes the formatting of the character at the caret or, if there is a selection, of the first character in the selection.

Reference

  • Defined in AfxNova/CRichEditCtx.inc:2870
  • Documented in Windows/WIndows Controls/RichEdit/CRichEditCtx Class.md
  • Topic: CRichEditCtx Class