---
id: "E:cAlgo.API.TextBox.TextChanged"
kind: "event"
type: "T:cAlgo.API.TextBox"
url: "https://help.ctrader.com/ctrader-algo/references/Controls/TextBox/TextChanged/"
---

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

# TextBox.TextChanged

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

## TextChanged

Occurs when the text has changed.

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 event Action<TextChangedEventArgs> TextChanged;
```

Python:

```python
textBox.TextChanged += handler  # handler(obj: TextChangedEventArgs)
```

### Returns

`Action<TextChangedEventArgs>` — 

### Examples

C#:

```csharp
var stopLossTextBox = new TextBox { Text = "20", Width = 80 };
stopLossTextBox.TextChanged += args =>
{
    if (double.TryParse(args.TextBox.Text, out var pips))
        Print("Stop loss set to {0} pips", pips);
};
Chart.AddControl(stopLossTextBox);
```

Python:

```python
def on_start(self):
    stopLossTextBox = TextBox()
    stopLossTextBox.Text = "20"
    stopLossTextBox.Width = 80
    stopLossTextBox.TextChanged += self.on_text_changed
    api.Chart.AddControl(stopLossTextBox)

def on_text_changed(self, args):
    api.Print(f"Stop loss input: {args.TextBox.Text}")
```

