Classes of TextBox, RichTextBox, and MaskedTextBox - Object-oriented programming

Classes of TextBox, RichTextBox, and MaskedTextBox

All the classes TextBox, RichTextBox, and MaskedTextBox are derived from the TextBoxBase class. The main elements of these classes are given in Table. 8.2.

The RichTextBox class allows you to store and display text in Rich Text Format (RTF) format, which supports special features of text formatting. In this class, there are additional properties, such as: SelectionFont - used font and SelectionColor - the color used. The text of this EC can be obtained by using the Text property (simply text, without formatting) or the Rtf property (text with formatting). The LoadFile () method allows you to enter text from a specified file. The SaveFile () method saves the text from the EE to the specified text file. If such a file already exists, it is overwritten.

Table 8.2

Basic elements of text fields

Element

Description

MultiLine

if true, then TextBox

can display text on more than one line

Lines

array of rows stored in an element

Text

stored text as a single line

TextLength

the total length of the text as a single line

MaxLength

maximum possible text length

SelectedText

User-selected text in the EC

(this text is highlighted when the EA receives focus)

SelectionLength

length of user-selected text

SelectionStart

the number of the character from which the selected text begins

AcceptsReturn

if set to true, pressing Enter will cause a new line to be created, rather than going to the default button

CharacterCasing

sets the used register; possible values ​​of the CharacterCasing: Normal enumeration. Lower or Upper

PasswordChar

the character that is used to display instead of the letters for entering passwords

The MaskedTextBox class allows you to restrict the user-entered text strings, as well as automatically format the input data. The Mask property contains the string string of the input string that specifies the number of characters, the type of allowed characters, and the format of the input numeric data (for example: 0-digit, 9-digit or space

# - number, space, + or L - letter; ? - a letter or a space). And the PromptChar property specifies a character that will be displayed instead of missing characters (default is

The Text property returns the text that was entered into the given ECU. The appearance of the text depends on the TextMaskFormat property, which can receive one of the values ​​of the MaskFormat enumeration:

• IncludeLiterals - include characters from the template;

• IncludePrompt - include the specified characters (prompt) for missing characters.

If, for example, a pattern specifies a phone number, then the Mask string will probably be the following: (999) 000-0000 & quot ;. And these characters will be included in the Text line if the IncludeLiteral property is set to true.

thematic pictures

Also We Can Offer!

Other services that we offer

If you don’t see the necessary subject, paper type, or topic in our list of available services and examples, don’t worry! We have a number of other academic disciplines to suit the needs of anyone who visits this website looking for help.

How to ...

We made your life easier with putting together a big number of articles and guidelines on how to plan and write different types of assignments (Essay, Research Paper, Dissertation etc)