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
Public property 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.
Public property BorderStyle enum Gets or sets the border style of the textbox. See BorderStyle for possible values.
Public property CharacterCasing enum Gets or sets a value that indicates how characters are cased when characters are typed into the TextBox. See CharacterCasing.
Public property 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.
Public property 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.
Public property 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).
Public property ReadOnly bool True to make text read-only so that it cannot be edited by the user. False indicates that it can be edited.
Public property TextAlign enum Gets or sets a value that determines how text is horizontally aligned in the control. See HorizontalAlignment.
Methods
  Name Description
Public property Create () Initializes a new instance of a TextBox.   
Public property 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.
Public property RemoveGradient() Removes the gradient.
Public property 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.
Public property 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.
Public property 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
Public event

KeyDown

Occurs when any key is pressed while the control has focus. See KeyEventArgs for the properties returned by the handler's args parameter.

Public event 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.
Public event KeyUp Occurs when any key is released while the control has focus. See KeyEventArgs for the properties returned by the handler's args parameter.
Public event TextChanged Occurs when the text is changed.