Export (0) Print
Expand All
Cut
Run
Expand Minimize

Collapse Method

Visual Studio .NET 2003

Collapses the selected text to the active point.

[Visual Basic .NET]
Public Sub Collapse() 
[Visual Basic 6]
Sub Collapse() 
[C++]
HRESULT __stdcall Collapse();
[C#]
public void Collapse();
[JScript .NET]
public function Collapse()

Example

Sub CollapseExample()
  ' This generates a text document listing all available command names.
  Dim Cmd As Command
  Dim PrjItem As ProjectItem
  Dim Doc As Document
  Dim TxtDoc As TextDocument
  DTE.ItemOperations.NewFile ("General\Text File")
  Set Doc = ActiveDocument
  Set TxtDoc = Doc.Object("TextDocument")
  For Each Cmd In Commands
  If (Cmd.Name <> "") Then
    TxtDoc.Selection.Text = Cmd.Name & vbLF
    TxtDoc.Selection.Collapse
  End If
  Next
End Sub

See Also

Applies To: TextSelection Object

Show:
© 2014 Microsoft