# Caret positioning and selection

The positioning and selection in **RadAutoCompleteBox** can be performed programmatically as well as by using the keyboard and mouse input.

To select items with the press the arrow keys while holding `Shift`.

Programmatic selection can be performed by using the **SelectionStart** and **SelectionLength** properties.

The **SelectionStart** property is an integer that indicates the insertion point within the string of text, with 0 being the left-most position. If the **SelectionStart** property is set to a value equal to or greater than the number of characters in the text box, the insertion point is placed after the last character.

Setting the **SelectionLength** to a number greater than 0 causes that number of characters to be selected, starting from the current insertion point.

```C#
private void SetSelection()
{
    this.radAutoCompleteBox1.Text = "Pepsi; Sprite; Coca-Cola;";
    this.radAutoCompleteBox1.SelectionStart = 6;
    this.radAutoCompleteBox1.SelectionLength = 7;
}
```

```VB.NET
Private Sub SetSelection()
    Me.RadAutoCompleteBox1.Text = "Pepsi; Sprite; Coca-Cola;"
    Me.RadAutoCompleteBox1.SelectionStart = 6
    Me.RadAutoCompleteBox1.SelectionLength = 7
End Sub
```

Alternatively, you can use the **Select** method to select the same part of the text:

```C#
private void SetSelectionRange()
{
    this.radAutoCompleteBox1.Text = "Pepsi;Sprite;Coca-Cola";
    this.radAutoCompleteBox1.Select(6, 7);
}
```

```VB.NET
Private Sub SetSelectionRange()
    Me.RadAutoCompleteBox1.Text = "Pepsi;Sprite;Coca-Cola"
    Me.RadAutoCompleteBox1.[Select](6, 7)
End Sub
```

The both approaches produce same result:

![WinForms RadAutoCompleteBox Select Text](https://www.telerik.com/products/winforms/documentation/assets/c15470cd7c6bd727e139201c67806c87/editors-autocompletebox-caret-positioning-and-selection001.png)

## See Also

* [Creating Custom Blocks](https://www.telerik.com/products/winforms/documentation/controls/editors/autocompletebox/creating-custom-blocks)
* [Element Structure and Document Object Model](https://www.telerik.com/products/winforms/documentation/controls/editors/autocompletebox/element-structure-and-document-object-model)
* [Properties and Events](https://www.telerik.com/products/winforms/documentation/controls/editors/autocompletebox/customizing-appearance/formatting-blocks)
* [Text Editing](https://www.telerik.com/products/winforms/documentation/controls/editors/autocompletebox/text-editing)
* [Auto-Complete](https://www.telerik.com/products/winforms/documentation/controls/editors/autocompletebox/auto-complete)
