Compartir a través de


TextSelection.DestructiveInsert(String) Method

Definition

Inserts text, overwriting the existing text.

public:
 void DestructiveInsert(System::String ^ Text);
public:
 void DestructiveInsert(Platform::String ^ Text);
void DestructiveInsert(std::wstring const & Text);
[System.Runtime.InteropServices.DispId(57)]
public void DestructiveInsert (string Text);
[<System.Runtime.InteropServices.DispId(57)>]
abstract member DestructiveInsert : string -> unit
Public Sub DestructiveInsert (Text As String)

Parameters

Text
String

Required. Represents the text to insert.

Attributes

Examples

Public objSel As TextSelection = DTE.ActiveDocument.Selection  

Sub DestructiveInsertExample()  
   ' Before running this example, open a text document.  
   ' Perform operations on the text.  
   objSel.StartOfDocument(False)  
   Position(vsStartOfLineOptions.vsStartOfLineOptionsFirstColumn, 4)  
   objSel.Copy()  
   Position(vsStartOfLineOptions.vsStartOfLineOptionsFirstText, 4)  
   objSel.Cut()  
   Position(vsStartOfLineOptions.vsStartOfLineOptionsFirstText, 4)  
   objSel.Delete()  
   Position(vsStartOfLineOptions.vsStartOfLineOptionsFirstText, 4)  
   objSel.DeleteLeft(6)  
   objSel.DestructiveInsert("NEW TEXT")  
End Sub  

Sub Position(ByVal pos As vsStartOfLineOptions, ByVal ipos As Integer)  
   ' Moves the insertion point down to the beginning of the next line,   
   ' and then highlights the right-most four characters.  
   objSel.LineDown()  
   objSel.StartOfLine(vsStartOfLineOptions.vsStartOfLineOptionsFirstText)  
   objSel.CharRight(True, 4)  
End Sub  

Remarks

Newline characters cause the text selection's active end to move to the beginning of the next line. It may also insert indentation depending on the language used in the text document.

Applies to