Export (0) Print
Expand All
Cut
Run
Expand Minimize

Insert Method (TextSelection Object)

Visual Studio .NET 2003

Inserts the given string at the current insertion point.

[Visual Basic .NET]
Public Sub Insert( _
   ByVal Text As String, _
   Optional ByVal Flags As Integer = 1 _
) 
[Visual Basic 6]
Sub Insert( _
   ByVal Text As String, _
   Optional ByVal Flags As Long = 1 _
) 
[C++]
HRESULT __stdcall Insert(
   BSTR Text,
   long Flags
);
[C#]
public void Insert(
   string Text,
   int Flags
);
[JScript .NET]
public function Insert(
   Text : String,
   Flags : int
)

Parameters

Text
The text to insert.
Flags
A vsInsertFlags constant indicating how to treat the inserted text.

Example

Sub InsertExample()
   ' Before running this example, open a text document.
   Dim objSel As TextSelection = DTE.ActiveDocument.Selection
   ' Go to 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

See Also

Applies To: TextSelection Object

Show:
© 2014 Microsoft