Text Settings in Windows Forms TextBox (TextBoxExt)

29 Apr 20214 minutes to read

This section discusses the text settings of the TextBoxExt control.


You can specifies the text in TextBoxExt control by using Text property.

this.textBoxExt1.SelectedText = "textBoxExt1";
Me.textBoxExt1.SelectedText = "textBoxExt1"

Set the text to WF TextBoxExt


You can get the selected text in TextBoxExt control by using SelectedText property.


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

Change the character casing of WF TextBoxExt


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

Change the text align for WF TextBoxExt

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

Change the WF TextBoxExt control position from right to left


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

Decides the text should be drawn when WF TextBoxExt is disabled

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

Show the multiline text in WF TextBoxExt


 The ScrollToCaret() method can be used to scroll the contents of the control to the current caret position.


The tooltip that should be displayed when an overflow of text occurs can be set using the following properties.

this.textBoxExt1.ShowOverflowIndicator = true;
this.textBoxExt1.ShowOverflowIndicatorToolTip = true;
this.textBoxExt1.OverflowIndicatorToolTipText = "Overflow";
Me.textBoxExt1.ShowOverflowIndicator = True
Me.textBoxExt1.ShowOverflowIndicatorToolTip = True
Me.textBoxExt1.OverflowIndicatorToolTipText = "Overflow"

Show the overflow indicator text in WF TextBoxExt


There is no value set for the OverflowIndicatorToolTipText property, then the value set for the Text property of the TextBoxExt will be displayed as the tooltip.