Partager via


ITextEdit.Delete Method

Definition

Overloads

Delete(Span)

Deletes a sequence of characters from the buffer.

Delete(Int32, Int32)

Deletes a equence of characters from the buffer.

Delete(Span)

Deletes a sequence of characters from the buffer.

public:
 bool Delete(Microsoft::VisualStudio::Text::Span deleteSpan);
public:
 bool Delete(Microsoft::VisualStudio::Text::Span deleteSpan);
bool Delete(Microsoft::VisualStudio::Text::Span deleteSpan);
public bool Delete (Microsoft.VisualStudio.Text.Span deleteSpan);
abstract member Delete : Microsoft.VisualStudio.Text.Span -> bool
Public Function Delete (deleteSpan As Span) As Boolean

Parameters

deleteSpan
Span

The span of characters to delete.

Returns

true if the deletion succeeded, false if it was prevented by a read-only region.

Exceptions

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

deleteSpan.End is greater than the length of the buffer.

Remarks

Deleting an empty span will succeed but will not generate a new snapshot or raise a Changed event.

Applies to

Delete(Int32, Int32)

Deletes a equence of characters from the buffer.

public:
 bool Delete(int startPosition, int charsToDelete);
public:
 bool Delete(int startPosition, int charsToDelete);
bool Delete(int startPosition, int charsToDelete);
public bool Delete (int startPosition, int charsToDelete);
abstract member Delete : int * int -> bool
Public Function Delete (startPosition As Integer, charsToDelete As Integer) As Boolean

Parameters

startPosition
Int32

The position of the first character to delete.

charsToDelete
Int32

The number of characters to delete.

Returns

true if the deletion succeeded; false if it was prevented by a read-only region.

Exceptions

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

startPosition is less than zero or greater than the length of the buffer, or charsToDelete is less than zero, or startPosition + charsToDelete is greater than the length of the buffer.

Remarks

Deleting zero characters will succeed but will not generate a new snapshot or raise a Changed event.

Applies to