IVsTextManager.NavigateToPosition Method (IVsTextBuffer, Guid, Int32, Int32)


Finds or creates an appropriate view on the specified buffer and puts the selection on the specified linear position.

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

int NavigateToPosition(
	IVsTextBuffer pBuffer,
	[InAttribute] ref Guid guidDocViewType,
	int iPos,
	int iLen


Type: Microsoft.VisualStudio.TextManager.Interop.IVsTextBuffer

[in] Pointer to the IVsTextBuffer interface.

Type: System.Guid

[in] GUID identifying the view. This value should always be LOGVIEWID_TextView.

Type: System.Int32

[in] Linear position in buffer on which to put the caret.

Type: System.Int32

[in] Length of selection.

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 IVsTextManager::NavigateToPosition(
   [in] IVsTextBuffer * pBuffer,
   [in] REFGUID guidDocViewType,
   [in] long iPos,
   [in] long iLen

This method is the same as NavigateToLineAndColumn, except that it uses one-dimensional, positional coordinates.

Return to top