Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.
Trending News
How can you add a 'tab' spacing to a RichTextBox?
I have richTextBox and I want to be able to press [Tab] and and insert a proper 'tab' spacing...
My current code works fine and looks something link this:
RichTextBox rTxtCode1= new RichTextBox(); // auto generated
// ignore the '----' spacers
void Tab_Pressed(object sender, EventArgs e)
{
----rTxtCode1.SelectedText += "----"; rTxtCode1.Focus();
}
What I want to do is make this more efficient by avoiding the leave~then~re-enter effect all together.
How can I go about doing this?
1 Answer
- 10 years agoFavorite Answer
You will probably need something like this:
For example if you need TabSpace here: "My name is\t Ed" will result in:
My name is Ed
so try to play with "\t"
void Tab_Pressed(object sender, EventArgs e)
{
rTxtCode1.SelectedText += "\t";
rTxtCode1.Focus();
}
Source(s): Own