---
id: "M:cAlgo.API.TextBox.#ctor"
kind: "constructor"
type: "T:cAlgo.API.TextBox"
url: "https://help.ctrader.com/ctrader-algo/references/Controls/TextBox/Constructor/"
---

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

# TextBox constructor

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

## TextBox()

Initializes a new instance of the [`TextBox`](https://help.ctrader.com/ctrader-algo/references/Controls/TextBox/index.md) class.

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 TextBox()
```

Python:

```python
TextBox()
```

### Examples

C#:

```csharp
var volumeTextBox = new TextBox { Text = "0.01", Width = 80 };
volumeTextBox.TextChanged += args => Print("Volume input: {0}", args.TextBox.Text);
Chart.AddControl(volumeTextBox);
```

Python:

```python
volumeTextBox = TextBox()
volumeTextBox.Text = "0.01"
volumeTextBox.Width = 80
volumeTextBox.TextChanged += lambda args: api.Print(f"Volume input: {args.TextBox.Text}")
api.Chart.AddControl(volumeTextBox)
```

