> ## Documentation Index
> Fetch the complete documentation index at: https://docs.abbyy.com/llms.txt
> Use this file to discover all available pages before exploring further.

# GetSelection Method of the TextEditor Object

> GetSelection method of the TextEditor Object in ABBYY FineReader Engine Visual Components on Windows — This method returns the beginning and the end cursor position of the selection.

This method returns the beginning and the end cursor position of the selection. If selection is undefined, all the properties of the output [EditorPosition](/fine-reader/engine/visual-components-reference/supplementary-objects/editorposition) objects are equal to -1.

## Syntax

### C++

```cpp theme={null}
HRESULT GetSelection(
  IEditorPosition** From,
  IEditorPosition** To
);
```

### C\#

```csharp theme={null}
HRESULT GetSelection(
  out IEditorPosition From,
  out IEditorPosition To
);
```

### Visual Basic .NET

```vb theme={null}
Sub GetSelection( _
  ByRef From As IEditorPosition, _
  ByRef To As IEditorPosition _
)
```

## Parameters

From

\[out] Contains the cursor position of the beginning of the selection as an [EditorPosition](/fine-reader/engine/visual-components-reference/supplementary-objects/editorposition) object.

To

\[out] Contains the cursor position of the end of the selection as an [EditorPosition](/fine-reader/engine/visual-components-reference/supplementary-objects/editorposition) object.

## Return values

This method has no specific return values. It returns the [standard return values of ABBYY FineReader Engine functions](/fine-reader/engine/api-reference/return-codes).

## See also

[TextEditor](/fine-reader/engine/visual-components-reference/texteditor)

[SetSelection](/fine-reader/engine/visual-components-reference/texteditor/setselection-method)
