IVsTextBuffer.GetLineIndexOfPosition Method (Int32, Int32, Int32)


Returns the line and column numbers in the text buffer, given a position number.

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

int GetLineIndexOfPosition(
	int iPosition,
	out int piLine,
	out int piColumn


Type: System.Int32

[in] Position number of the desired line.

Type: System.Int32

[out] Pointer to the line number.

Type: System.Int32

[out] Pointer to the column position on the line.

Return Value

Type: System.Int32

If the method succeeds, it returns S_OK. If it fails, it returns an error code.

From textmgr.idl:

HRESULT IVsTextBuffer::GetLineIndexOfPosition(
   [in] long iPosition,
   [out] long *piLine,
   [out] CharIndex *piColumn

This method might require considerable resources, depending upon the underlying implementation of the buffer. That is, it might be very difficult to calculate the size of the buffer if it is a virtual-line-oriented implementation as in Visual Basic.

Return to top