Members

Technology Zones

IBM Learning Center

Articles

Hosted By

MaximumASP

Info

Rated
Read 100,489 times

Contents

Related Categories

Rich Text Box Controls - Basic Formatting

ZERO-COOL

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.

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

Comments

  • hi

    Posted by kailas on 17 Oct 2005

    hi redstar...

    m also facing same problem.. do u got any solution?

    with regards,

    kailas

  • arrow intendation

    Posted by sshamsudheen on 21 Apr 2005

    how to get arrow intendation

  • bullet intending

    Posted by sshamsudheen on 21 Apr 2005

    how to chane the bullet intend as arrow

  • Saving and Loading Text formats

    Posted by DanTheMan on 03 Feb 2005

    I am wondering if thier is a way to save and load text formatting using VB6, for example fonts, text colors etc. Does anybody know any easy ways round it???

  • a work around

    Posted by ulaska on 26 Aug 2003

    Try the following code as work around:

    ' flag the section with bullet mark
    rtfSectionText.SelBullet = True

    ' replace bullet with numbers
    rtfSectionText.SelRTF = Replace(rtfSectionText.SelRTF, ...