See Also: TextBox Members
With the System.Windows.Forms.TextBox control, the user can enter text in an application. This control has additional functionality that is not found in the standard Windows text box control, including multiline editing and password character masking.
Typically, a System.Windows.Forms.TextBox control is used to display, or accept as input, a single line of text. You can use the TextBoxBase.Multiline and TextBox.ScrollBars properties to enable multiple lines of text to be displayed or entered. Set the TextBoxBase.AcceptsTab and TextBox.AcceptsReturn properties to true to enable greater text manipulation in a multiline System.Windows.Forms.TextBox control.
You must set the TextBoxBase.Multiline property to true to adjust the height of the System.Windows.Forms.TextBox control. You can adjust the height by setting the Control.Size property.
You can limit the amount of text entered into a System.Windows.Forms.TextBox control by setting the TextBoxBase.MaxLength property to a specific number of characters. System.Windows.Forms.TextBox controls can also be used to accept passwords and other sensitive information. You can use the TextBox.PasswordChar property to mask characters entered in a single-line version of the control. Use the TextBox.CharacterCasing property to enable the user to type only uppercase, only lowercase, or a combination of uppercase and lowercase characters into the System.Windows.Forms.TextBox control.
To scroll the contents of the System.Windows.Forms.TextBox until the cursor (caret) is within the visible region of the control, you can use the TextBoxBase.ScrollToCaret method. To select a range of text in the text box, you can use the TextBoxBase.Select(int, int) method.
To restrict text from being entered in a System.Windows.Forms.TextBox control, you can create an event handler for the Control.KeyDown event in order to validate each character entered in the control. You can also restrict all entry of data in a System.Windows.Forms.TextBox control by setting the TextBoxBase.ReadOnly property to true.
Most of the functionality of the System.Windows.Forms.TextBox control is inherited from the System.Windows.Forms.TextBoxBase class.
Using the System.Windows.Forms.TextBox control with visual styles enabled will cause the incorrect handling of surrogate fonts.