IVsTextView.GetLineAndColumn Method

Converts a text stream position to a line and column index.

Namespace:  Microsoft.VisualStudio.TextManager.Interop
Assembly:  Microsoft.VisualStudio.TextManager.Interop (in Microsoft.VisualStudio.TextManager.Interop.dll)

Syntax

'Declaration
Function GetLineAndColumn ( _
    iPos As Integer, _
    <OutAttribute> ByRef piLine As Integer, _
    <OutAttribute> ByRef piIndex As Integer _
) As Integer
int GetLineAndColumn(
    int iPos,
    out int piLine,
    out int piIndex
)
int GetLineAndColumn(
    [InAttribute] int iPos, 
    [OutAttribute] int% piLine, 
    [OutAttribute] int% piIndex
)
abstract GetLineAndColumn : 
        iPos:int * 
        piLine:int byref * 
        piIndex:int byref -> int
function GetLineAndColumn(
    iPos : int, 
    piLine : int, 
    piIndex : int
) : int

Parameters

  • iPos
    Type: System.Int32

    [in] Integer containing the position in the text stream.

  • piLine
    Type: System.Int32%

    [out] Pointer containing the line index corresponding to the stream position.

  • piIndex
    Type: System.Int32%

    [out] Pointer containing the column index corresponding to the stream position.

Return Value

Type: System.Int32
If the method succeeds, it returns S_OK. If it fails, it returns an error code.

Remarks

COM Signature

From textmgr.idl:

HRESULT IVsTextView::GetLineAndColumn(
   [in] long iPos,
   [out] long *piLine,
   [out] CharIndex *piIndex
);

Use this method to convert a text stream position to a line and column index. To convert a line and column index to a text stream position, use GetNearestPosition. The GetNearestPosition method accounts for virtual space in the view and provides the position of the end-of-line (EOL) marker on the given line if the column is in virtual space or at the end. Virtual space is space that shows in the view but if not part of the text buffer. The virtual space setting is access from Tools\Options\Text Editor\All Languages\General. For more information, see Options, Text Editor, All Languages.

.NET Framework Security

See Also

Reference

IVsTextView Interface

Microsoft.VisualStudio.TextManager.Interop Namespace