TextBox Class
The TextBox class is a form control that displays a text string within a container in a form that can be edited by the user. The text will wrap within the specified width and height of the control. Scroll bars will appear if the text wraps outside the specified width and height boundaries.
Namespace: elsystem.windows.forms
Properties
Additional properties, methods, and events are described in the classes listed under Inheritance Hierarchy (see below).
Name | Type | Description | |
AcceptsReturn | bool | Gets or sets a value that indicates whether pressing Enter creates a new line of text in a multiline TextBox. Note: This property has no effect if the Multiline property (see below) is false. | |
AcceptsTab | bool | Gets or sets a value that indicates whether pressing the Tab key causes a tab character to be placed in the TextBox (AcceptsTab = true), rather than causing the focus to move to the next control in the tab order (AcceptsTab = false). Note: Applies to Multiline TextBox controls only. This property has no effect if the Multiline property (see below) is false. | |
BorderStyle | enum | Gets or sets the border style of the textbox. See BorderStyle for possible values. | |
CharacterCasing | enum | Gets or sets a value that indicates how characters are cased when characters are typed into the TextBox. See CharacterCasing. | |
MaxLength | int | Gets or sets the maximum number of characters that can be manually entered into the text box. The default is 0, which indicates no limit. | |
Multiline | bool | Gets or sets a value indicating that the TextBox is a multiline TextBox. Set to true to allow multiple lines of text in the control. False (default) ignores carriage returns and limits text to a single line. See also the AcceptsReturn property, above. | |
PasswordChar | char | Gets or sets the character used to mask characters in a single line TextBox (e.g., a TextBox in which the user types a password). | |
ReadOnly | bool | True to make text read-only so that it cannot be edited by the user. False indicates that it can be edited. | |
TextAlign | enum | Gets or sets a value that determines how text is horizontally aligned in the control. See HorizontalAlignment. |
Methods
Name | Description | |
Create () | Initializes a new instance of a TextBox. | |
Create (text,width,height) | Initializes a new instance of the control. Parameters include the text to be displayed followed by the width and height of the control. | |
RemoveGradient() | Removes the gradient. | |
Select(start,length) | Gets a sub-string from the text box string based on the position of the start character and length of characters to select. | |
SetLinearGradient(mode, startColor, endColor) | Creates a linear gradient textbox background using the specified mode and start/end colors. See LinearGradientMode and Color for lists of possible values. | |
SetRadialGradient(startColor, endColor) | Creates a radial gradient textbox background using the specified start/en colors. See Color for a list of possible values. |
Events
Name | Description | |
KeyDown |
Occurs when any key is pressed while the control has focus. See KeyEventArgs for the properties returned by the handler's args parameter. |
|
KeyPress | Occurs when a character, space, or backspace key is pressed while the control has focus. See KeyPressEventArgs for the properties returned by the handler's args parameter. | |
KeyUp | Occurs when any key is released while the control has focus. See KeyEventArgs for the properties returned by the handler's args parameter. | |
TextChanged | Occurs when the text is changed. |