Export (0) Print
Expand All
Cut
Run
Expand Minimize

LineDown Method (TextSelection Object)

Visual Studio .NET 2003

Moves the selected line down a specified number of lines.

[Visual Basic .NET]
Public Sub LineDown( _
   Optional ByVal Extend As Boolean = False, _
   Optional ByVal Count As Integer = 1 _
) 
[Visual Basic 6]
Sub LineDown( _
   Optional ByVal Extend As Boolean = False, _
   Optional ByVal Count As Long = 1 _
) 
[C++]
HRESULT __stdcall LineDown(
   VARIANT_BOOL Extend,
   long Count
);
[C#]
public void LineDown(
   bool Extend,
   int Count
);
[JScript .NET]
public function LineDown(
   Extend : Boolean,
   Count : int
)

Parameters

Extend
Optional. Determines whether the moved text is collapsed or not. The default is False.
Count
Optional. Indicates how many lines to move down. The default value is 1.

Remarks

Moves the selected text down Count number of lines from the current position. If Extend is True, then the active end of the selected text is moved down Count lines, otherwise, it's collapsed and positioned Count lines down from the active end. If the end of the document is encountered before Count lines, then the position remains at the end of the document. LineDown tries to match the display column from the line of origin to the target line, rounding down a character position, if necessary, if it ends up in the middle of a tab on the target line.

If the value of Count is negative, then LineDown performs like LineUp.

Example

Sub LineDownExample()
    ' Before running this example, open a text document.
    Dim objSel As TextSelection = DTE.ActiveDocument.Selection

    ' Move to the beginning of the document so we can iterate over the 
    ' whole thing.
    objSel.StartOfDocument()
    While objSel.FindPattern("#if _DEBUG")
        ' If we found the beginning of a debug-only section, save the 
        ' position.
        Dim lStartLine As Long = objSel.TopPoint.Line
        Dim lStartColumn As Long = objSel.TopPoint.LineCharOffset

        ' Look for the end.
        If objSel.FindPattern("#endif") Then
            ' Select the entire section and outline it.
            objSel.SwapAnchor()
            objSel.MoveToLineAndOffset(lStartLine, lStartColumn, True)
            objSel.OutlineSection()
            objSel.LineDown()
        End If
    End While
End Sub

See Also

Applies To: TextSelection Object

Show:
© 2015 Microsoft