TextBox

The TextBox control is a very basic text-input control which allows the user to enter a single line of text.

To create a non-editable TextBlock, see TextBlock.

Properties

The key properties of a TextBox include:

  • Text. The editable text you want to display.
  • TextWrapping. Whether to wrap the text.
    • No Wrap
    • Wrap (and hyphenate a word that extends beyond the boundary of the control).
    • Wrap with Overflow (extend the text beyond the boundary of the control to accommodate, rather than hyphenate, the word that doesn’t fit.)
  • TextAlignment. Set the (Left, Centre, Right, Justify) alignment of the text.

Scripting Syntax

The properties of a control include events. Scripts can be used to set the properties of a control or be used to trigger an action associated with an event. For a TextBox:

  • The contents of a TextBox is the text to be displayed in the form. To add text to the TextBox programmatically use the following syntax:
  • TextBox1.Text = ‘The editable text to show.’

Adding a TextBox