共用方式為


TextSelection.Insert 方法

在目前的插入點插入指定的字串。

命名空間:  EnvDTE
組件:  EnvDTE (在 EnvDTE.dll 中)

語法

'宣告
Sub Insert ( _
    Text As String, _
    vsInsertFlagsCollapseToEndValue As Integer _
)
void Insert(
    string Text,
    int vsInsertFlagsCollapseToEndValue
)
void Insert(
    [InAttribute] String^ Text, 
    [InAttribute] int vsInsertFlagsCollapseToEndValue
)
abstract Insert : 
        Text:string * 
        vsInsertFlagsCollapseToEndValue:int -> unit 
function Insert(
    Text : String, 
    vsInsertFlagsCollapseToEndValue : int
)

參數

範例

[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

.NET Framework 安全性

請參閱

參考

TextSelection 介面

EnvDTE 命名空間