Textbox Control in VB.NET
Text box control is widely used for entering some input values at run time.
Text box control is also used to display some text on the form which user may edit.
Properties of Textbox Control
| Property | Purpose | ||||||
AutoCompleteMode |
It is used to get or set value which determines how AutoComplete option works for TextBox. |
||||||
AutoCompleteSource |
It is used to get or set Auto Complete Source for TextBox. |
||||||
AutoCompleteCustomSource |
It is used to specify Custom Source by defining list of items in it. It works when AutoCompleteSource is set to CustomSource. |
||||||
BackColor |
It is used to get or set background color of the TextBox. |
||||||
CharacterCasing |
It is used to get or set value which determines weather all the characters entered in TextBox are converted to UpperCase, LowerCase or left as it is. It has following 3 options: |
||||||
Enabled |
It is used to specify weather TextBox 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 TextBox Control. |
||||||
ForeColor |
It is used to get or set Fore color of the text associated with TextBox Control. |
||||||
HideSelection |
It is used to specify weather text selection should be hidden or not when TextBox 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 TextBox. Default value is 32767. |
||||||
Multiline |
It is used to specify weather TextBox can be expanded to enter more than one line of text or not. It has Boolean value. Default value is false. |
||||||
PasswordChar |
It is used to get or set a character that is displayed for each input characters in TextBox. |
||||||
ReadOnly |
It is used to specify weather text associated with TextBox is ReadOnly or not. It has Boolean value. Default value is false. |
||||||
ScrollBars |
It is used to get or set type of scrollbars to be added with TextBox control when Multi line property is set to true. It has following 4 options: |
||||||
TabIndex |
It is used to get or set Tab order of the TextBox. |
||||||
TabStop |
It is used to specify weather user can use TAB key to set focus on TextBox Control or not. It has Boolean value. Default value is true. |
||||||
Text |
It is used to get or set text associated with TextBox Control. |
||||||
TextAlign |
It is used to get or set alignment of the text associated with TextBox Control. |
||||||
Visible |
It is used to specify weather TextBox 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 TextBox control or not. It has Boolean value. Default value is true. |
||||||
SelectionStart |
It is used to get or set starting point of the text selected in the TextBox. |
||||||
SelectionLength |
It is used to get or set number of characters selected in the TextBox. |
||||||
SelectedText |
It is used to get or set currently selected text in TextBox. |
||||||
Methods of Textbox Control in VB.NET
| Method | Purpose |
AppendText |
It is used to append text at the end of current text in TextBox Control. |
Clear |
It is used to clear all text from TextBox Control. |
Cut |
It is used to move current selection of TextBox into clipboard. |
Copy |
It is used to copies selected text of TextBox 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 TextBox control where cursor is currently located. |
Select |
It is used to select specific text from TextBox. |
SelectAll |
It is used to select all text of TextBox. |
DeselectAll |
It is used to deselect all text selected in TextBox. |
Undo |
It is used to undo last edit operation of TextBox. |
ClearUndo |
It is used to clear information from the Undo buffer of the TextBox. |
Show |
It is used to show TextBox at run time. |
Hide |
It is used to hide TextBox at run time. |
Focus |
It is used to set input focus to textbox Control. |
Events of Textbox Control
| Event | Purpose |
TextChanged |
It is the default event of TextBox Control. It fires each time a text in the TextBox control is changed. |
GotFocus |
It fires each time a focus is set on TextBox. |
LostFocus |
It fires each time a focus is lost from TextBox. |