RichTextBox Control

Advanced Formatting

Apart from making text bold, underlined, italic or strikethrough you can also use bullets, tab stops and left and right indents. Of these, tab stops are the most complicated and will be covered in another section. Note: For any of these examples, set the Scale Mode property on the Form that the text box is contained to Millimetres, or adjust the values shown in any examples on this page.

Statement Action
RichTextBox1.SelBullet = True Makes the selected text bulleted
RichTextBox1.BulletIndent = 10 Sets the distance between the bullet and the text to 10 (applies to all)
RichTextBox1.RightMargin = 100 Sets the right margin of all the text in the Rich Text Box to 100.
RichTextBox1.SelRightIndent = 100 Sets the right indent of all the selected text in the Rich Text Box to 100 (measured from the left).
RichTextBox1.SelIndent = 100 Sets the selected text left indent to 100

So, the following code will set make the selected text bulleted, indents by 10 mm and sets the right margin to 100 mm

' Set the forms scale mode
Me.ScaleMode = vbMillimeters
' Set the bullet
RichTextBox1.SelBullet = True
' Set the indent
RichTextBox1.SelIndent = 10
' Set the right margin
RichTextBox1.RightMargin = 100

You might also like...

Comments

About the author

James Crowley

James Crowley United Kingdom

James first started this website when learning Visual Basic back in 1999 whilst studying his GCSEs. The site grew steadily over the years while being run as a hobby - to a regular monthly audien...

Interested in writing for us? Find out more.

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Hofstadter's Law: It always takes longer than you expect, even when you take into account Hofstadter's Law.”