JavaScript Editor JavaScript Editor     JavaScript Debugger

Previous Section Next Section

Main Page

Text Boxes

We've discussed text boxes in the In Depth section of this chapter and already put them to use throughout the book. Take a look at Tables 5.5, 5.6, and 5.7 to see the notable properties, methods, and events of the TextBox class. These tables do not include all the notable properties, methods, and events this class inherits from the Control class—you'll find them in Tables 5.1, 5.2, and 5.3.

Table 5.5: Noteworthy public properties of TextBox objects.

Property

Means

AutoSize

Sets/gets a value specifying if the height of the control automatically adjusts when the font in the control is changed.

BackColor

Sets/gets the background color of the control.

BorderStyle

Sets/gets the border type of the text box control.

CanUndo

Returns a value specifying if the user can undo the previous operation.

ForeColor

Sets/gets the foreground color.

HideSelection

Sets/gets a value specifying if the selected text in the text box control remains highlighted when the text box loses focus.

Lines

Sets/gets the lines of text.

MaxLength

Sets/gets the maximum number of characters the user can type into the text box.

Modified

Indicates if the text box control has been modified by the user since the control was created or its contents were last set.

Multiline

Sets/gets a value specifying if this is a multiline text box control.

PasswordChar

Sets/gets the character used to mask characters of a password in a single-line text box.

ReadOnly

Sets/gets a value specifying if text in the text box is read-only.

ScrollBars

Sets/gets what scroll bars should appear in a multiline text box.

SelectedText

Sets/gets a value specifying the currently selected text in the control.

SelectionLength

Sets/gets the number of characters selected in the text box.

SelectionStart

Sets/gets the starting point of text selected in the text box.

Text

Sets/gets the current text in the text box.

TextAlign

Sets/gets how text is aligned in a text box control.

TextLength

Gets the length of text in the control.

WordWrap

Indicates if a multiline text box control automatically wraps words.

Table 5.6: Noteworthy public methods of TextBox objects.

Methods

Means

AppendText

Appends text to the current text in the text box.

Clear

Clears all text from the text box.

ClearUndo

Clears information about the most recent operation of the text box.

Copy

Copies the selected text in the text box to the Clipboard.

Cut

Moves the selected text in the text box to the Clipboard.

Paste

Replaces the selected text in the text box with the contents of the Clipboard.

ScrollToCaret

Scrolls the text box to the caret position.

Select

Selects text in the text box.

SelectAll

Selects all text in the text box.

Undo

Undoes the last edit operation in the text box.

Table 5.7: Noteworthy public events of TextBox objects.

Event

Means

AutoSizeChanged

Occurs when the value of the AutoSize property is changed.

Click

Occurs when the text box is clicked.

ReadOnlyChanged

Occurs when the value of the ReadOnly property is changed.

Previous Section Next Section




JavaScript Editor Free JavaScript Editor     JavaScript Editor