CTextRange2.SetTextmethod
Sets the plain text in this range.
Syntax
FUNCTION SetText (BYREF wszText AS WSTRING, BYVAL Flags AS LONG = 0) AS HRESULT
Parameters
| Name | Description | |
|---|---|---|
Flags | Flags controlling how the text is inserted in the range. The flag can be one of the following values (see table below) | |
wszText | Text that replaces the current text in this range. If "", the current text is deleted. |
Return value
The method returns an HRESULT value. If the method succeeds, it returns S_OK. If the method fails, it returns one of the following COM error codes.
Description
Sets the text of this range.
Remarks
This method is similar to SetText, but lets the client specify flags that control various insertion options, including the special flag tomLanguageTag to get the BCP-47 language tag for the range. This is an industry standard language tag that may be preferable SetLanguageID, which uses a language code identifier (LCID).
Example
DIM pRange2 AS CTextRange2 = pRichEdit.Range2(3, 8) DIM dwsText AS DWSTRING = "new text" pRange2.SetText(dwsText) ' You can also use a string literal pRange2.SetText("new text") ' or pass an empty string to delete the range pRange2.SetText("")
Reference
- Defined in AfxNova/CTextRange2.inc:182
- Documented in Windows/WIndows Controls/RichEdit/CTextRange2 Class.md
- Topic: CTextRange2 Class