|
|
Title | Set tabs in a RichTextBox in Visual Basic .NET |
Description | This example shows how to set tabs in a RichTextBox in Visual Basic .NET. |
Keywords | RichTextBox, tabs, VB.NET |
Categories | VB.NET, Controls |
|
|
The RichTextBox control can set different tabs for different parts of its text so this example makes some text, selects it, and then sets its tabs.
In the following code, the program uses the control's SelectAll method to select all of the text. It sets the SelectionTabs property to an array of Integers giving the tab positions. It sets AcceptsTab to True to ensure that tab characters go into the control rather than tabbing off to the next control and then it moves the selection position to the beginning of the text.
|
|
rchDocument.SelectAll()
rchDocument.SelectionTabs = New Integer() {20, 40, 80, 120}
rchDocument.AcceptsTab = True
rchDocument.Select(0, 0)
|
|
|
|
|
|