System.Windows.Forms.ToolStripTextBox Class

Represents a text box in a System.Windows.Forms.ToolStrip that allows the user to enter text.

See Also: ToolStripTextBox Members

Syntax

[System.Windows.Forms.Design.ToolStripItemDesignerAvailability(System.Windows.Forms.Design.ToolStripItemDesignerAvailability.ToolStrip | System.Windows.Forms.Design.ToolStripItemDesignerAvailability.MenuStrip | System.Windows.Forms.Design.ToolStripItemDesignerAvailability.ContextMenuStrip)]
public class ToolStripTextBox : ToolStripControlHost

Remarks

System.Windows.Forms.ToolStripTextBox is the System.Windows.Forms.TextBox optimized for hosting in a System.Windows.Forms.ToolStrip. A subset of the hosted control's properties and events are exposed at the System.Windows.Forms.ToolStripTextBox level, but the underlying System.Windows.Forms.TextBox control is fully accessible through the ToolStripTextBox.TextBox property.

The System.Windows.Forms.ToolStripTextBox control allows the user to enter text in an application. This control has additional functionality that is not found in the standard Windows text box control, including multiline editing.

Typically, a System.Windows.Forms.ToolStripTextBox control is used to display a single line of text or accept it as input. You can use the ToolStripTextBox.Multiline to enable multiple lines of text to be displayed or entered. Set the ToolStripTextBox.AcceptsTab and ToolStripTextBox.AcceptsReturn properties to true to allow greater text manipulation in a multiline System.Windows.Forms.ToolStripTextBox control.

You can limit the amount of text entered into a System.Windows.Forms.ToolStripTextBox control by setting the ToolStripTextBox.MaxLength property to a specific number of characters. Use the ToolStripTextBox.CharacterCasing property to allow the user to type only uppercase, only lowercase, or a combination of uppercase and lowercase characters into the System.Windows.Forms.ToolStripTextBox control.

To restrict text from being entered in a System.Windows.Forms.ToolStripTextBox 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.ToolStripTextBox control by setting the ToolStripTextBox.ReadOnly property to true.

Requirements

Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
Assembly Versions: 2.0.0.0
Since: .NET 2.0