Partager via


ITextEdit.Delete Method (Int32, Int32)

Deletes a sequence of characters from the buffer.

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

Syntax

'Declaration
Function Delete ( _
    startPosition As Integer, _
    charsToDelete As Integer _
) As Boolean
bool Delete(
    int startPosition,
    int charsToDelete
)
bool Delete(
    int startPosition, 
    int charsToDelete
)
abstract Delete : 
        startPosition:int * 
        charsToDelete:int -> bool
function Delete(
    startPosition : int, 
    charsToDelete : int
) : boolean

Parameters

  • startPosition
    Type: Int32

    The position of the first character to delete.

  • charsToDelete
    Type: Int32

    The number of characters to delete.

Return Value

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

Exceptions

Exception Condition
InvalidOperationException

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

ArgumentOutOfRangeException

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.

.NET Framework Security

See Also

Reference

ITextEdit Interface

Delete Overload

Microsoft.VisualStudio.Text Namespace