2

I'm using System.Windows.Forms.RichTextBox and by default the tab size is 8 spaces. The RichTextBox itself is not that big and 8 spaces leads to a lot of scrolling. Is there any way to make it 4 spaces. If it matters, the control is initially blank and the user starts entering stuff and the tabs have to shorter (4 spaces) as the user enters text with tabs.

I tried Modifying default tab size in RichTextBox and a few variations of it but no luck.

Community
  • 1
  • 1
Bala R
  • 107,317
  • 23
  • 199
  • 210

1 Answers1

1

Maybe you should carefully read the answers you link to.

You cannot set the tabs for 'the RichEdit' but only for a selection inside the RichEdit.

You need something like:

rtb.SelectAll();  
rtb.SelectionTabs = new int[] { 100, 200, 300, 400 };
H H
  • 263,252
  • 30
  • 330
  • 514