Article ID: 143273 - View products that this article applies to.
This article was previously published under Q143273
The RichTextBox control allows you to create RTF documents from within your Visual Basic program. If you press the TAB key while a RichTextBox control has the focus, the focus is moved to the next control in the tab order rather than inserting a tab character into the RichTextBox control. This article explains how you can insert the TAB character into the RichTextBox control itself.
At run-time, a user must press CTRL+TAB to insert a TAB character in a RichTextBox control. However, most people are accustomed to just simply pressing the TAB key. Whenever the TAB key is pressed from within a RichTextBox control, the focus is immediately set to the next control on the form.
In the demonstration program below, we change the TabStop property of all controls on the form to False. While the RichTextBox control has the focus, the TAB key is prevented from setting the focus to another control. This is because the TabStop property is set to False. Therefore, the TAB control character is correctly inserted into the text of the RichTextBox control.
How to Create the Demonstration ProgramThe demonstration program below shows how to insert a TAB control character in the RichTextBox control provided in Visual Basic.
Article ID: 143273 - Last Review: July 1, 2004 - Revision: 2.1
Contact us for more help
Connect with Answer Desk for expert help.