TextSelection.Insert(String, Int32) 方法

定义

在当前插入点插入给定字符串。

void Insert(std::wstring const & Text, int vsInsertFlagsCollapseToEndValue = 1);
[System.Runtime.InteropServices.DispId(35)]
public void Insert (string Text, int vsInsertFlagsCollapseToEndValue = 1);
[<System.Runtime.InteropServices.DispId(35)>]
abstract member Insert : string * int -> unit
Public Sub Insert (Text As String, Optional vsInsertFlagsCollapseToEndValue As Integer = 1)

参数

Text
String

要插入的文本。

vsInsertFlagsCollapseToEndValue
Int32

vsInsertFlags值之一,指示如何插入文本。

属性

示例

[Visual Basic]

Sub InsertExample()  
   ' Before running this example, open a text document.  
   Dim objSel As TextSelection = DTE.ActiveDocument.Selection  
   ' Go to the first line in document and select it.  
   objSel.GotoLine(1, True)  
   ' Insert some new lines and some text.  
   objSel.NewLine(3)  
   objSel.Insert("A new line", vsInsertFlags.vsInsertFlagsInsertAtStart)  
End Sub  

适用于