ITextEdit::Insert Method (Int32, String^)

 

Inserts the given text at the specified positionin the text buffer.

Namespace:   Microsoft.VisualStudio.Text
Assembly:  Microsoft.VisualStudio.Text.Data (in Microsoft.VisualStudio.Text.Data.dll)

bool Insert(
	int position,
	String^ text
)

Parameters

position
Type: System::Int32

The buffer position at which the first character of the text will appear.

text
Type: System::String^

The text to be inserted.

Return Value

Type: System::Boolean

true if the insertion succeeded, false if it failed due to a read-only region.

Exception Condition
ArgumentNullException

text is null.

InvalidOperationException

The Apply or Cancel or Dispose method has previously been called on this object.

ArgumentOutOfRangeException

position is less than zero or greater than the length of the buffer.

Inserting an empty string will succeed, but will not generate a new snapshot or raise a Changed event.

Return to top
Show: