# Sandbox.UI.Label.SetCaretPosition

```csharp
void SetCaretPosition(int pos, bool select = False)
```

Set the text caret position to the given index.

### Parameters

- `pos` (`int`): Where to move the text caret to within the text.
- `select` (`bool`), default `False`: Whether to also add the characters we passed by to the selection.

Declared in [Sandbox.UI.Label](/api/Sandbox.UI.Label).
Assembly: `Sandbox.Engine`.
