Rich Text Box Controls

Basic Formatting

There are many different settings for the format of a rich textbox.  The four basic ones are: SelBold, SelItalic, SelUnderline, and SelStrikethru.  These are all booleans(True or False).  Any text editing after these are changed will be displayed the way selected, but the text already there will not bet changed.

Changing these settings:

Object.SelBold = Boolean
Object.SelItalic = Boolean
Object.SelUnderline = Boolean
Object.SelStrikethru = Boolean

RichTextBox1.SelUnderline = True
'Any text after this property is turned on will be underlined

Next you will learn how to change the font size and font name. Changing the font size and name is very simple.  You just need to know the name of the font you want.  Also the font name doesn't have to be case sensitive.

Change the font name:

Object.SelFontName = FontName

If the font name is a variable, then you don't requir quotes, else you must put quotes around it

RichTextBox1.SelFontName = "Times New Roman"
'Or
Dim Font As String
Font = "Times New Roman"
RichTextBox1.SelFont = Font

The font size is even simpler

Object.SelFontSize = Integer

RichTextBox1.SelFontSize = 12
'The following text will be size 12

The number for a font size doesn't need to be in quotes, but a variable could represent a number.

You might also like...

Comments

About the author

ZERO-COOL United States

I'm a 12 year old child who is interested in learning programming languages. My current two are Visual Basic and C++.

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.

“PHP is a minor evil perpetrated and created by incompetent amateurs, whereas Perl is a great and insidious evil perpetrated by skilled but perverted professionals.” - Jon Ribbens