---
id: "P:cAlgo.API.ComboBox.SelectedIndex"
kind: "property"
type: "T:cAlgo.API.ComboBox"
url: "https://help.ctrader.com/ctrader-algo/references/Controls/ComboBox/SelectedIndex/"
---

> Documentation index for agents: https://help.ctrader.com/ctrader-algo/llms.txt · machine index: https://help.ctrader.com/ctrader-algo/api.json

# ComboBox.SelectedIndex

Member of [ComboBox](https://help.ctrader.com/ctrader-algo/references/Controls/ComboBox/index.md).

## SelectedIndex

Set / Get the ComboBox selected item index

Environments: Desktop supported · CLI not supported · Cloud not supported.

- CLI: Accepted without error but never displayed, so control events such as Click are never raised.
- Cloud: Accepted without error but never displayed, so control events such as Click are never raised.

C#:

```csharp
public int SelectedIndex {get; set;}
```

Python:

```python
comboBox.SelectedIndex: int
```

### Returns

`int` — 

### Examples

C#:

```csharp
var comboBox = new ComboBox();
comboBox.AddItem("Hour");
comboBox.AddItem("Daily");
comboBox.SelectedIndex = 1;
Chart.AddControl(comboBox);
Print("Selected index: {0}, item: {1}", comboBox.SelectedIndex, comboBox.SelectedItem);
```

Python:

```python
comboBox = ComboBox()
comboBox.AddItem("Hour")
comboBox.AddItem("Daily")
comboBox.SelectedIndex = 1
api.Chart.AddControl(comboBox)
api.Print(f"Selected index: {comboBox.SelectedIndex}, item: {comboBox.SelectedItem}")
```

