RichTextBox Control in VB.NET
RichTextBox Control allows user to display, input, edit and format text information.
RichTextBox Control supports advance formatting features as compared to TextBox. Using RichTextBox user can format only selected portion of the text. User can also format paragraph using RichTextBox Control.
RichTextBox Control also allows user to save as well as load file of RTF format and Standard ASCII format.
Properties of RichTextBox Control in VB.NET
| Property | Purpose | ||||||
AutoWordSelection |
It is used to specify weather automatic word selection is ON or OFF. It has Boolean value. Default value is false. |
||||||
BackColor |
It is used to get or set background color of the RichTextBox. |
||||||
ContextMenuStrip |
It is used to specify the name of shortcut menu that is displayed when user right clicks on the RichTextBox. |
||||||
DetectUrls |
It is used to specify weather URL that is entered in RichTextBox is automatically displayed as hyperlink or not. It has Boolean value. Default value is true. |
||||||
Enabled |
It is used to specify weather RichTextBox Control is enabled or not at run time. It has Boolean value. Default value is true. |
||||||
Font |
It is used to set Font Face, Font Style, Font Size and Effects of the text associated with RichTextBox Control. |
||||||
ForeColor |
It is used to get or set Fore color of the text associated with RichTextBox Control. |
||||||
HideSelection |
It is used to specify weather text selection should be hidden or not when RichTextBox lose its focus. It has Boolean value. Default value is true. |
||||||
MaxLength |
It is used to get or set maximum number of characters that can be entered in RichTextBox. Default value is 2147483647. |
||||||
Multiline |
It is used to specify weather RichTextBox can be expanded to enter more than one line of text or not. It has Boolean value. Default value is true. |
||||||
ReadOnly |
It is used to specify weather text associated with RichTextBox is ReadOnly or not. It has Boolean value. Default value is false. |
||||||
RightMargin |
It is used to get or set right margin of the text in RichTextBox. |
||||||
ScrollBars |
It is used to get or set type of scrollbars to be added with RichTextBox control. It has following 4 options: |
||||||
Size |
It is used to get or set height and width of RichTextBox control in pixel. |
||||||
Text |
It is used to get or set text associated with RichTextBox Control. |
||||||
TabIndex |
It is used to get or set Tab order of the RichTextBox. |
||||||
TabStop |
It is used to specify weather user can use TAB key to set focus on RichTextBox Control or not. It has Boolean value. Default value is true. |
||||||
Visible |
It is used to specify weather RichTextBox Control is visible or not at run time. It has Boolean value. Default value is true. |
||||||
WordWrap |
It is used to specify weather line will be automatically word wrapped while entering multiple line of text in RichTextBox control or not. It has Boolean value. Default value is true. |
||||||
ZoomFactor |
It is used to get or set current zoom level of RichTextBox. |
||||||
SelectedRtf |
It is used to get or set currently selected RTF formatted text in RichTextBox. |
||||||
SelectedText |
It is used to get or set currently selected text in RichTextBox. |
||||||
SelectionAlignment |
It is used to get or set horizontal alignment of the text selected in RichTextBox. |
||||||
SelectionBackColor |
It is used to get or set BackColor of the text selected in RichTextBox. |
||||||
SelectionBullet |
It is used to get or set value which determines weather bullet style should be applied to selected text or not. |
||||||
SelectionColor |
It is used to get or set Fore Color of the text selected in RichTextBox. |
||||||
SelectionFont |
It is used to get or set font face, font style, and font size of the text selected in RichTextBox. |
||||||
SelectionLength |
It is used to get or set number of characters selected in the RichTextBox. |
||||||
SelectionStart |
It is used to get or set starting point of the text selected in the RichTextBox. |
||||||
Methods of RichTextBox Control in VB.NET
| Method | Purpose |
Cut |
It is used to move current selection of RichTextBox into clipboard. |
Copy |
It is used to copies selected text of RichTextBox in clipboard. |
Paste |
It is used to replace current selection of TextBox by contents of clipboard. It is also used to move contents of Clipboard to RichTextBox control where cursor is currently located. |
Select |
It is used to select specific text from RichTextBox. |
SelectAll |
It is used to select all text of RichTextBox. |
DeselectAll |
It is used to deselect all text selected in RichTextBox. |
Clear |
It is used to clear all text from RichTextBox Control. |
AppendText |
It is used to append text at the end of current text in RichTextBox Control. |
ClearUndo |
It is used to clear information from the Undo buffer of the RichTextBox. |
Find |
It is used to find starting position of first occurrence of a string in the RichTextBox control. If a string is not found then it returns -1. |
SaveFile |
It is used to save contents of RichTextBox in to Rich Text Format (RTF) file. |
LoadFile |
It is used to loads a Rich Text Format (RTF) file or standard ASCII text file into RichTextBox Control. |
Undo |
It is used to undo last edit operation of RichTextBox. |
Redo |
It is used to redo the last operation that is undo using undo method. |
Events of RichTextBox Control in VB.NET
| Event | Purpose |
TextChanged |
It is the default event of RichTextBox Control. It fires each time a text in the RichTextBox control changed. |