TextBox

The TextBox control lets the user enter and edit text values. Typically, a user interface would send the value in a text control to a connected device when a button is clicked. However, text controls can send messages whenever the text value is changed. The value of the control can also be set by commands from a connected device.

Design-time Properties for the TextBox control
PropertyDescription
TextThe current value of the text displayed
TextAlignSets whether the text is shown on the left, right or centered in the control
ScrollBarsSets which scroll bars are shown for the control
PasswordCharThe control value is displayed using this character (if set). The underlying value is still available to commands though
UseSystemPasswordCharWhen true, the control value is displayed using the standard system password character (•). The underlying value is still available to commands though
MaxLengthLimits the maximum length of text that can be entered
MultilineWhen true, multiple lines of text can be entered; if false only a single line of text is supported
AcceptsReturnWhen true, pressing the enter key creates a new-line in a multi-line control. If false, you’ll need to use Alt+Enter to create a new line.
AcceptsTabWhen true, pressing tab will insert a tab character into a multiline edit control. Otherwise it will move the focus to the next control
WordWrapWhen true, long lines of text will be wrapped inside multi-line controls.
ReadOnlyIf true, the user can’t edit text in the control
Run-time Properties for the TextBox control
NameAccessTypeDescription
NameRead onlystringThe name of the control
TextRead/writestringThe current value of the text displayed
TextLengthRead onlyintGets the length of text in the control
ReadOnlyRead/writeboolControls whether the user can edit the text in the control
Run-time properties common to most controls
PropertyAccessTypeDescription
VisibleRead/writeboolHide/show the control
EnabledRead/writeboolEnable/disable the control. When a control is disabled it is visible but shown grayed out and you can't interact with it.
ForeColorRead/writestringAdjust the foreground color
BackColorRead/writestringAdjust the background color
Run-time Methods for the TextBox control
NameReturnsDescription
FixedLengthText(int Length)stringReturns the first Length characters from the control value. If the value is shorter than Length spaces (‘ ‘) will be added to the end until it is exactly Length characters long.
FixedLengthText(int Length, string Alignment)stringReturns the first Length characters from the control value. If the value is shorter than Length spaces (‘ ‘) will be added to the value until it is exactly Length characters long. Spaces are added to the start or end of the value when Alignment is Right or Left. If Alignment is Center an equal number of spaces is added to the start and end of the value.
FixedLengthText(int Length, string Alignment, char Padding)stringReturns the first Length characters from the control value. If the value is shorter than Length the Padding character will be added to the value until it is exactly Length characters long. The Padding character is added to the start or end of the value when Alignment is Right or Left. If Alignment is Center an equal number of Padding characters is added to the start and end of the value.
Recent Posts

Leave a Comment

Start typing and press Enter to search