ITextEdit.Insert Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
Insert(Int32, String) |
Inserts the given |
Insert(Int32, Char[], Int32, Int32) |
Inserts an array of characters at the specified |
Insert(Int32, String)
Inserts the given text
at the specified position
in the text buffer.
public:
bool Insert(int position, System::String ^ text);
public:
bool Insert(int position, Platform::String ^ text);
bool Insert(int position, std::wstring const & text);
public bool Insert (int position, string text);
abstract member Insert : int * string -> bool
Public Function Insert (position As Integer, text As String) As Boolean
Parameters
- position
- Int32
The buffer position at which the first character of the text will appear.
- text
- String
The text to be inserted.
Returns
true
if the insertion succeeded, false
if it failed due to a read-only region.
Exceptions
position
is less than zero or greater than the length of the buffer.
text
is null.
Remarks
Inserting an empty string will succeed but will not generate a new snapshot or raise a Changed event.
Applies to
Insert(Int32, Char[], Int32, Int32)
Inserts an array of characters at the specified position
in the ITextBuffer.
public:
bool Insert(int position, cli::array <char> ^ characterBuffer, int startIndex, int length);
public:
bool Insert(int position, Platform::Array <char16> ^ characterBuffer, int startIndex, int length);
bool Insert(int position, std::Array <char> const & characterBuffer, int startIndex, int length);
public bool Insert (int position, char[] characterBuffer, int startIndex, int length);
abstract member Insert : int * char[] * int * int -> bool
Public Function Insert (position As Integer, characterBuffer As Char(), startIndex As Integer, length As Integer) As Boolean
Parameters
- position
- Int32
The buffer position at which the first character of the text will appear.
- characterBuffer
- Char[]
The character array from which characters will be inserted.
- startIndex
- Int32
The index in characterBuffer
of the first character to insert.
- length
- Int32
The number of characters to insert from characterBuffer
.
Returns
true
if the insertion succeeded, false
if it was prevented by a read-only region.
Exceptions
characterBuffer
is null.
Remarks
Inserting zero characters will succeed but will not generate a new snapshot or raise a Changed event.