- Text
- CharacterCasing
- TextAlign
- Right to Left
- DrawActiveWhenDisabled
- Tooltip
Contact Support
Text Settings in Windows Forms TextBox (TextBoxExt)
5 Sep 20234 minutes to read
This section discusses the text settings of the TextBoxExt control.
Text
You can specifies the text in TextBoxExt control by using Text property.
this.textBoxExt1.SelectedText = "textBoxExt1";
Me.textBoxExt1.SelectedText = "textBoxExt1"
NOTE
You can get the selected text in TextBoxExt control by using SelectedText property.
CharacterCasing
You can change the case of character in TextBoxExt
control by using CharacterCasing property. The character casing options are Normal, Upper and Lower.
this.textBoxExt1.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper;
Me.textBoxExt1.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper
TextAlign
You can the alignment of text for TextBoxExt
control by using TextAlign property.
this.textBoxExt1.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
Me.textBoxExt1.TextAlign = System.Windows.Forms.HorizontalAlignment.Center
Right to Left
The TextBoxExt
control can be laid out from right to left when the RightToLeft property value is set to Yes
.
this.textBoxExt1.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
Me.textBoxExt1.RightToLeft = System.Windows.Forms.RightToLeft.Yes
DrawActiveWhenDisabled
The DrawActiveWhenDisabled property specifies whether the text should be drawn active even when the control is disabled.
this.textBoxExt1.Enabled = false;
this.textBoxExt1.DrawActiveWhenDisabled = true;
Me.textBoxExt1.Enabled = False
Me.textBoxExt1.DrawActiveWhenDisabled = True
The following methods are associated with the above properties.
Methods | Description |
---|---|
AppendText | Appends text to the current text of a textbox. |
OnCharacterCasingChanged | Raises the CharacterCasingChanged event. |
GetClipText | Gets / sets the clipped text without the formatting. |
Cut | Cuts the selected data to the clipboard. |
Copy | Copies the content of the NumberTextBox to the clipboard. The ClipMode property dictates what gets copied. |
Delete | Deletes the current selection of the TextBox. |
Paste | Pastes the data in the clipboard into the NumberTextBox control. |
Select | Selects a range of text in the TextBox. |
SelectAll | Selects all text in the TextBox. |
Multiline text settings
You can display the multiple line text by using the MultiLine property. If you want to show the text move to next line, you need to set the WordWrap property to true
. You can also show the horizontal or vertical bar in TextBoxExt
control by using ScrollBars property.
this.textBoxExt1.Multiline = true;
this.textBoxExt1.WordWrap = true;
this.textBoxExt1.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
Me.textBoxExt1.Multiline = True
Me.textBoxExt1.WordWrap = True
Me.textBoxExt1.ScrollBars = System.Windows.Forms.ScrollBars.Vertical
NOTE
The ScrollToCaret() method can be used to scroll the contents of the control to the current caret position.
Tooltip
The tooltip that should be displayed when an overflow of text occurs can be set using the following properties.
- OverflowIndicatorToolTipText - This property specifies the overflow indicator tooltip text.
- ShowOverflowIndicator - This property used for show the overflow indicator.
- ShowOverflowIndicatorToolTip - This property indicates whether to show the overflow indicator tooltip.
this.textBoxExt1.ShowOverflowIndicator = true;
this.textBoxExt1.ShowOverflowIndicatorToolTip = true;
this.textBoxExt1.OverflowIndicatorToolTipText = "Overflow";
Me.textBoxExt1.ShowOverflowIndicator = True
Me.textBoxExt1.ShowOverflowIndicatorToolTip = True
Me.textBoxExt1.OverflowIndicatorToolTipText = "Overflow"
NOTE
There is no value set for the
OverflowIndicatorToolTipText
property, then the value set for theText
property of the TextBoxExt will be displayed as the tooltip.