UID | title | description | helpviewer_keywords | old-location | tech.root | ms.assetid | ms.date | ms.keywords | req.header | req.include-header | req.target-type | req.target-min-winverclnt | req.target-min-winversvr | req.kmdf-ver | req.umdf-ver | req.ddi-compliance | req.unicode-ansi | req.idl | req.max-support | req.namespace | req.assembly | req.type-library | req.lib | req.dll | req.irql | targetos | req.typenames | req.redist | ms.custom | f1_keywords | dev_langs | topic_type | api_type | api_location | api_name | |||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
NF:tom.ITextRange.SetText |
ITextRange::SetText (tom.h) |
Sets the text in this range. |
|
controls\ITextRange_SetText.htm |
Controls |
VS|Controls|~\controls\richedit\textobjectmodel\textobjectmodelreference\textobjectmodelinterfaces\settext.htm |
12/05/2018 |
ITextRange interface [Windows Controls],SetText method, ITextRange.SetText, ITextRange::SetText, SetText, SetText method [Windows Controls], SetText method [Windows Controls],ITextRange interface, _win32_ITextRange_SetText, _win32_ITextRange_SetText_cpp, controls.ITextRange_SetText, controls._win32_ITextRange_SetText, tom/ITextRange::SetText |
tom.h |
Windows |
Windows Vista [desktop apps only] |
Windows Server 2003 [desktop apps only] |
Msftedit.dll |
Windows |
19H1 |
|
|
|
|
|
|
Sets the text in this range.
Type: BSTR
Text that replaces the current text in this range. If null, the current text is deleted.
Type: HRESULT
The method returns an HRESULT value. If the method succeeds, it returns S_OK. If the method fails, it returns one of the following error codes. For more information about COM error codes, see Error Handling in COM.
Return code | Description |
---|---|
|
Text is write-protected. |
|
bstr is null. |
|
Out of memory. |
ITextRange::SetText replaces the text in the range with the new text. In contrast, TypeText replaces the selection with the text bstr and leaves the selection as an insertion point just following the inserted text, just as if you had typed the text in. For UI selection behavior, see TypeText.
If, after you call ITextRange::SetText, you call ITextRange::GetText, you get back the same text that you set with the ITextRange::SetText method (unless some other range has changed that text in between the calls).
Conceptual
Reference