Editable Text Controls: TextBoxBase
In addition to all of the controls that have a run-of-the-mill Text property, there are several controls whose sole purpose is to display editable text. The Label control displays text, but is read-only.
The TextBoxBase class provides a base class for three controls that allow the read-write display of text:
- TextBox
Displays text with no formatting other than the current Font of the control. Has a 64K character capacity limit.
- DataGridTextBox
A text box hosted in a DataGridTextBoxColumn control. Derives from TextBox.
- RichTextBox
Displays text with formatting.
Figure 12-1 shows the class hierarchy of the TextBoxBase class.
![TextBoxBase class hierarchy](/api/v2/epubs/0596003218/files/httpatomoreillycomsourceoreillyimages74843.png)
Figure 12-1. TextBoxBase class hierarchy
Properties and Methods
The TextBoxBase class has many properties and methods in addition to those inherited from Control. Many of the properties are listed in Table 12-1 and the methods in Table 12-4. Many of the most commonly used properties and methods are demonstrated in the examples that follow.
Table 12-1. TextBoxBase properties
Property |
Value type |
Description |
---|---|---|
AcceptsTab |
Boolean |
Read/write. Applies to multiline TextBoxes and RichTextBoxes. If
|
AutoSize |
Boolean |
Read/write. If |
Get Programming .NET Windows Applications now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.